@@ -64,7 +64,7 @@ static const uint8_t gZero;
64
64
/*
65
65
*--------------------------------------------------------------------------
66
66
*
67
- * _bson_next_power_of_two_for_alloc --
67
+ * _bson_round_up_alloc_size --
68
68
*
69
69
* Given a potential allocation length in bytes, round up to the
70
70
* next power of two without exceeding BSON_MAX_SIZE.
@@ -81,7 +81,7 @@ static const uint8_t gZero;
81
81
*/
82
82
83
83
static BSON_INLINE size_t
84
- _bson_next_power_of_two_for_alloc (size_t size )
84
+ _bson_round_up_alloc_size (size_t size )
85
85
{
86
86
if (size <= BSON_MAX_SIZE ) {
87
87
size_t power_of_two = bson_next_power_of_two (size );
@@ -121,7 +121,7 @@ _bson_impl_inline_grow (bson_impl_inline_t *impl, /* IN */
121
121
return true;
122
122
}
123
123
124
- req = _bson_next_power_of_two_for_alloc (impl -> len + size );
124
+ req = _bson_round_up_alloc_size (impl -> len + size );
125
125
126
126
if (req <= BSON_MAX_SIZE ) {
127
127
data = bson_malloc (req );
@@ -188,7 +188,7 @@ _bson_impl_alloc_grow (bson_impl_alloc_t *impl, /* IN */
188
188
return true;
189
189
}
190
190
191
- req = _bson_next_power_of_two_for_alloc (req );
191
+ req = _bson_round_up_alloc_size (req );
192
192
193
193
if ((req <= BSON_MAX_SIZE ) && impl -> realloc ) {
194
194
* impl -> buf = impl -> realloc (* impl -> buf , req , impl -> realloc_func_ctx );
@@ -2136,7 +2136,7 @@ bson_copy_to (const bson_t *src, bson_t *dst)
2136
2136
}
2137
2137
2138
2138
data = _bson_data (src );
2139
- len = _bson_next_power_of_two_for_alloc ((size_t ) src -> len );
2139
+ len = _bson_round_up_alloc_size ((size_t ) src -> len );
2140
2140
2141
2141
adst = (bson_impl_alloc_t * ) dst ;
2142
2142
adst -> flags = BSON_FLAG_STATIC ;
0 commit comments