Skip to content

Commit 150d9c2

Browse files
author
Micah Scott
committed
Add _uninit suffix to allocators for uninitialized vectors
1 parent dc9d22f commit 150d9c2

10 files changed

+79
-79
lines changed

src/libbson/doc/binary_vector.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ Integration
4040
:titlesonly:
4141
:maxdepth: 1
4242

43-
bson_append_vector_int8
44-
bson_append_vector_float32
45-
bson_append_vector_packed_bit
43+
bson_append_vector_int8_uninit
44+
bson_append_vector_float32_uninit
45+
bson_append_vector_packed_bit_uninit
4646

4747
* Accessing an existing Vector via :symbol:`bson_iter_t`:
4848

src/libbson/doc/bson_append_vector_float32.rst renamed to src/libbson/doc/bson_append_vector_float32_uninit.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
:man_page: bson_append_vector_float32
1+
:man_page: bson_append_vector_float32_uninit
22

3-
bson_append_vector_float32()
4-
============================
3+
bson_append_vector_float32_uninit()
4+
===================================
55

66
Synopsis
77
--------
88

99
.. code-block:: c
1010
11-
#define BSON_APPEND_VECTOR_FLOAT32(b, key, count, view) \
12-
bson_append_vector_float32 (b, key, (int) strlen (key), count, view)
11+
#define BSON_APPEND_VECTOR_FLOAT32_UNINIT(b, key, count, view) \
12+
bson_append_vector_float32_uninit (b, key, (int) strlen (key), count, view)
1313
1414
bool
15-
bson_append_vector_float32 (bson_t *bson,
16-
const char *key,
17-
int key_length,
18-
size_t element_count,
19-
bson_vector_float32_view_t *view_out);
15+
bson_append_vector_float32_uninit (bson_t *bson,
16+
const char *key,
17+
int key_length,
18+
size_t element_count,
19+
bson_vector_float32_view_t *view_out);
2020
2121
Parameters
2222
----------
@@ -34,7 +34,7 @@ Appends a new field to ``bson`` by allocating a Vector with the indicated number
3434
The elements will be uninitialized.
3535
On success, the caller must write every element in the Vector if the resulting :symbol:`bson_t` is to be used.
3636

37-
The pointer written to ``*view_out`` is only valid until ``bson`` is otherwise modified or freed.
37+
The view written to ``*view_out`` is only valid until ``bson`` is otherwise modified or freed.
3838

3939
Returns
4040
-------

src/libbson/doc/bson_append_vector_int8.rst renamed to src/libbson/doc/bson_append_vector_int8_uninit.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
:man_page: bson_append_vector_int8
1+
:man_page: bson_append_vector_int8_uninit
22

3-
bson_append_vector_int8()
4-
=========================
3+
bson_append_vector_int8_uninit()
4+
================================
55

66
Synopsis
77
--------
88

99
.. code-block:: c
1010
11-
#define BSON_APPEND_VECTOR_INT8(b, key, count, view) \
12-
bson_append_vector_int8 (b, key, (int) strlen (key), count, view)
11+
#define BSON_APPEND_VECTOR_INT8_UNINIT(b, key, count, view) \
12+
bson_append_vector_int8_uninit (b, key, (int) strlen (key), count, view)
1313
1414
bool
15-
bson_append_vector_int8 (bson_t *bson,
16-
const char *key,
17-
int key_length,
18-
size_t element_count,
19-
bson_vector_int8_view_t *view_out);
15+
bson_append_vector_int8_uninit (bson_t *bson,
16+
const char *key,
17+
int key_length,
18+
size_t element_count,
19+
bson_vector_int8_view_t *view_out);
2020
2121
Parameters
2222
----------
@@ -34,7 +34,7 @@ Appends a new field to ``bson`` by allocating a Vector with the indicated number
3434
The elements will be uninitialized.
3535
On success, the caller must write every element in the Vector if the resulting :symbol:`bson_t` is to be used.
3636

37-
The pointer written to ``*view_out`` is only valid until ``bson`` is otherwise modified or freed.
37+
The view written to ``*view_out`` is only valid until ``bson`` is otherwise modified or freed.
3838

3939
Returns
4040
-------

src/libbson/doc/bson_append_vector_packed_bit.rst renamed to src/libbson/doc/bson_append_vector_packed_bit_uninit.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
:man_page: bson_append_vector_packed_bit
1+
:man_page: bson_append_vector_packed_bit_uninit
22

3-
bson_append_vector_packed_bit()
3+
bson_append_vector_packed_bit_uninit()
44
===============================
55

66
Synopsis
77
--------
88

99
.. code-block:: c
1010
11-
#define BSON_APPEND_VECTOR_PACKED_BIT(b, key, count, view) \
12-
bson_append_vector_packed_bit (b, key, (int) strlen (key), count, view)
11+
#define BSON_APPEND_VECTOR_PACKED_BIT_UNINIT(b, key, count, view) \
12+
bson_append_vector_packed_bit_uninit (b, key, (int) strlen (key), count, view)
1313
1414
bool
15-
bson_append_vector_packed_bit (bson_t *bson,
16-
const char *key,
17-
int key_length,
18-
size_t element_count,
19-
bson_vector_packed_bit_view_t *view_out);
15+
bson_append_vector_packed_bit_uninit (bson_t *bson,
16+
const char *key,
17+
int key_length,
18+
size_t element_count,
19+
bson_vector_packed_bit_view_t *view_out);
2020
2121
Parameters
2222
----------
@@ -34,7 +34,7 @@ Appends a new field to ``bson`` by allocating a Vector with the indicated number
3434
The elements will be uninitialized.
3535
On success, the caller must write every element in the Vector if the resulting :symbol:`bson_t` is to be used.
3636

37-
The pointer written to ``*view_out`` is only valid until ``bson`` is otherwise modified or freed.
37+
The view written to ``*view_out`` is only valid until ``bson`` is otherwise modified or freed.
3838

3939
Returns
4040
-------

src/libbson/doc/bson_vector_float32_view_t.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ Example
5050
const size_t values_count = sizeof values / sizeof values[0];
5151
5252
bson_vector_float32_view_t view;
53-
BSON_ASSERT (BSON_APPEND_VECTOR_FLOAT32 (&doc, "vector", values_count, &view));
53+
BSON_ASSERT (BSON_APPEND_VECTOR_FLOAT32_UNINIT (&doc, "vector", values_count, &view));
5454
BSON_ASSERT (bson_vector_float32_view_write (view, values, values_count, 0));
5555
5656
.. seealso::
5757

58-
| :symbol:`bson_append_vector_float32`
58+
| :symbol:`bson_append_vector_float32_uninit`
5959
| :symbol:`bson_vector_float32_const_view_t`

src/libbson/doc/bson_vector_int8_view_t.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ Example
5151
const size_t values_count = sizeof values / sizeof values[0];
5252
5353
bson_vector_int8_view_t view;
54-
BSON_ASSERT (BSON_APPEND_VECTOR_INT8 (&doc, "vector", values_count, &view));
54+
BSON_ASSERT (BSON_APPEND_VECTOR_INT8_UNINIT (&doc, "vector", values_count, &view));
5555
BSON_ASSERT (bson_vector_int8_view_write (view, values, values_count, 0));
5656
5757
.. seealso::
5858

59-
| :symbol:`bson_append_vector_int8`
59+
| :symbol:`bson_append_vector_int8_uninit`
6060
| :symbol:`bson_vector_int8_const_view_t`

src/libbson/doc/bson_vector_packed_bit_view_t.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Example
5656
const size_t bool_values_count = sizeof bool_values / sizeof bool_values[0];
5757
5858
bson_vector_packed_bit_view_t view;
59-
BSON_ASSERT (BSON_APPEND_VECTOR_PACKED_BIT (&doc, "from_bool", bool_values_count, &view));
59+
BSON_ASSERT (BSON_APPEND_VECTOR_PACKED_BIT_UNINIT (&doc, "from_bool", bool_values_count, &view));
6060
BSON_ASSERT (bson_vector_packed_bit_view_pack_bool (view, bool_values, bool_values_count, 0));
6161
}
6262
@@ -67,7 +67,7 @@ Example
6767
const size_t packed_values_count = sizeof packed_bytes * 8 - unused_bits_count;
6868
6969
bson_vector_packed_bit_view_t view;
70-
BSON_ASSERT (BSON_APPEND_VECTOR_PACKED_BIT (&doc, "from_packed", packed_values_count, &view));
70+
BSON_ASSERT (BSON_APPEND_VECTOR_PACKED_BIT_UNINIT (&doc, "from_packed", packed_values_count, &view));
7171
BSON_ASSERT (bson_vector_packed_bit_view_write_packed (view, packed_bytes, sizeof packed_bytes, 0));
7272
}
7373
@@ -81,5 +81,5 @@ Example
8181
8282
.. seealso::
8383

84-
| :symbol:`bson_append_vector_packed_bit`
84+
| :symbol:`bson_append_vector_packed_bit_uninit`
8585
| :symbol:`bson_vector_packed_bit_const_view_t`

src/libbson/src/bson/bson-vector.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ bson_vector_packed_bit_const_view_from_iter (bson_vector_packed_bit_const_view_t
287287

288288

289289
bool
290-
bson_append_vector_int8 (
290+
bson_append_vector_int8_uninit (
291291
bson_t *bson, const char *key, int key_length, size_t element_count, bson_vector_int8_view_t *view_out)
292292
{
293293
BSON_ASSERT_PARAM (bson);
@@ -312,7 +312,7 @@ bson_append_vector_int8 (
312312
}
313313

314314
bool
315-
bson_append_vector_float32 (
315+
bson_append_vector_float32_uninit (
316316
bson_t *bson, const char *key, int key_length, size_t element_count, bson_vector_float32_view_t *view_out)
317317
{
318318
BSON_ASSERT_PARAM (bson);
@@ -337,7 +337,7 @@ bson_append_vector_float32 (
337337
}
338338

339339
bool
340-
bson_append_vector_packed_bit (
340+
bson_append_vector_packed_bit_uninit (
341341
bson_t *bson, const char *key, int key_length, size_t element_count, bson_vector_packed_bit_view_t *view_out)
342342
{
343343
BSON_ASSERT_PARAM (bson);
@@ -432,7 +432,7 @@ bson_append_vector_int8_from_array (
432432
}
433433

434434
bson_vector_int8_view_t view;
435-
if (!bson_append_vector_int8 (bson, key, key_length, element_count, &view)) {
435+
if (!bson_append_vector_int8_uninit (bson, key, key_length, element_count, &view)) {
436436
bson_vector_set_error_max_size (error);
437437
return false;
438438
}
@@ -474,7 +474,7 @@ bson_append_vector_float32_from_array (
474474
}
475475

476476
bson_vector_float32_view_t view;
477-
if (!bson_append_vector_float32 (bson, key, key_length, element_count, &view)) {
477+
if (!bson_append_vector_float32_uninit (bson, key, key_length, element_count, &view)) {
478478
bson_vector_set_error_max_size (error);
479479
return false;
480480
}
@@ -526,7 +526,7 @@ bson_append_vector_packed_bit_from_array (
526526
}
527527

528528
bson_vector_packed_bit_view_t view;
529-
if (!bson_append_vector_packed_bit (bson, key, key_length, element_count, &view)) {
529+
if (!bson_append_vector_packed_bit_uninit (bson, key, key_length, element_count, &view)) {
530530
bson_vector_set_error_max_size (error);
531531
return false;
532532
}

src/libbson/src/bson/bson-vector.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,24 +192,24 @@ bson_array_builder_append_vector_elements (struct _bson_array_builder_t *builder
192192

193193

194194
BSON_EXPORT (bool)
195-
bson_append_vector_int8 (
195+
bson_append_vector_int8_uninit (
196196
bson_t *bson, const char *key, int key_length, size_t element_count, bson_vector_int8_view_t *view_out);
197197

198-
#define BSON_APPEND_VECTOR_INT8(b, key, count, view) bson_append_vector_int8 (b, key, (int) strlen (key), count, view)
198+
#define BSON_APPEND_VECTOR_INT8_UNINIT(b, key, count, view) bson_append_vector_int8_uninit (b, key, (int) strlen (key), count, view)
199199

200200
BSON_EXPORT (bool)
201-
bson_append_vector_float32 (
201+
bson_append_vector_float32_uninit (
202202
bson_t *bson, const char *key, int key_length, size_t element_count, bson_vector_float32_view_t *view_out);
203203

204-
#define BSON_APPEND_VECTOR_FLOAT32(b, key, count, view) \
205-
bson_append_vector_float32 (b, key, (int) strlen (key), count, view)
204+
#define BSON_APPEND_VECTOR_FLOAT32_UNINIT(b, key, count, view) \
205+
bson_append_vector_float32_uninit (b, key, (int) strlen (key), count, view)
206206

207207
BSON_EXPORT (bool)
208-
bson_append_vector_packed_bit (
208+
bson_append_vector_packed_bit_uninit (
209209
bson_t *bson, const char *key, int key_length, size_t element_count, bson_vector_packed_bit_view_t *view_out);
210210

211-
#define BSON_APPEND_VECTOR_PACKED_BIT(b, key, count, view) \
212-
bson_append_vector_packed_bit (b, key, (int) strlen (key), count, view)
211+
#define BSON_APPEND_VECTOR_PACKED_BIT_UNINIT(b, key, count, view) \
212+
bson_append_vector_packed_bit_uninit (b, key, (int) strlen (key), count, view)
213213

214214

215215
BSON_EXPORT (bool)

0 commit comments

Comments
 (0)