bson/bson.c
/**
 * bson_append:
 * @bson: A bson_t.
 * @n_pairs: Number of length,buffer pairs.
 * @n_bytes: the total number of bytes being appended.
 * @first_len: Length of first buffer.
 * @first_data: First buffer.
 *
 * Variadic function to append length,buffer pairs to a bson_t. If the
 * append would cause the bson_t to overflow a 32-bit length, it will return
 * FALSE and no append will have occurred.
 *
 * Returns: TRUE if successful; otherwise FALSE.
 */


Variadic function to append length,buffer pairs to a bson_t. If the
append would cause the bson_t to overflow a 32-bit length, it will return
FALSE and no append will have occurred.

TRUE if successful; otherwise FALSE.
Variadic function to append length buffer pairs to a bson_t . If the append would cause the bson_t to overflow a 32 - bit length it will return FALSE and no append will have occurred . TRUE if successful ; otherwise FALSE .
static bson_bool_t
bson_append (bson_t             *bson,
             bson_uint32_t       n_pairs,
             size_t              n_bytes,
             bson_uint32_t       first_len,
             const bson_uint8_t *first_data,
             ...)
{
   va_list args;
   BSON_ASSERT(bson);
   BSON_ASSERT(n_pairs);
   BSON_ASSERT(first_len);
   BSON_ASSERT(first_data);
   if (BSON_UNLIKELY(n_bytes > (BSON_MAX_SIZE - bson->len))) {
      return FALSE;
   }
   va_start(args, first_data);
   bson_append_va(bson, n_bytes, n_pairs, first_len, first_data, args);
   va_end(args);
   return TRUE;
}
static bson_bool_t bson_append ( bson_t * bson , bson_uint32_t n_pairs , size_t n_bytes , bson_uint32_t first_len , const bson_uint8_t * first_data , ... ) { va_list args ; BSON_ASSERT ( bson ) ; BSON_ASSERT ( n_pairs ) ; BSON_ASSERT ( first_len ) ; BSON_ASSERT ( first_data ) ; if ( BSON_UNLIKELY ( n_bytes > ( BSON_MAX_SIZE - bson -> len ) ) ) { return FALSE ; } va_start ( args , first_data ) ; bson_append_va ( bson , n_bytes , n_pairs , first_len , first_data , args ) ; va_end ( args ) ; return TRUE ; }
bson_append:
 @bson: A bson_t.
bson_append : @bson : A bson_t .
/*
    * Check to see if this append would overflow 32-bit signed integer. I know
    * what you're thinking. BSON uses a signed 32-bit length field? Yeah. It
    * does.
    */