Skip to content

Commit 6f9e482

Browse files
authored
CDRIVER-5935 remove deprecated bson_copy_to_excluding (#1946)
1 parent 77be562 commit 6f9e482

File tree

10 files changed

+11
-85
lines changed

10 files changed

+11
-85
lines changed

src/libbson/NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ libbson 2.0.0 (Unreleased)
1616
* `bson_t` and `bson_iter_t` are now aligned to the size of a pointer instead of `128`.
1717
* `bson_error_t`, `bson_value_t`, and `bson_visitor_t` are now aligned to the size of a pointer instead of `8`.
1818
* `BSON_ALIGNED_BEGIN` and `BSON_ALIGNED_END` now unconditionally apply their requested alignment.
19+
* Remove deprecated `bson_copy_to_excluding`. Use `bson_copy_to_excluding_noinit` instead.
1920

2021

2122
libbson 1.30.2

src/libbson/doc/bson_copy_to_excluding.rst

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/libbson/doc/bson_copy_to_excluding_noinit.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ Description
2727
The :symbol:`bson_copy_to_excluding_noinit()` function shall copy all fields
2828
from ``src`` to ``dst`` except those specified by the variadic, NULL terminated
2929
list of keys starting from ``first_exclude``.
30-
Works the same way as :symbol:`bson_copy_to_excluding`, except does **not** call
31-
:symbol:`bson_init` on ``dst``.
32-
This function should be preferred in new code over :symbol:`bson_copy_to_excluding`.
30+
31+
Does **not** call :symbol:`bson_init` on ``dst``.
3332

3433
.. warning::
3534

src/libbson/doc/bson_copy_to_excluding_noinit_va.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Description
2727

2828
The :symbol:`bson_copy_to_excluding_noinit_va()` function shall copy all fields from ``src`` to ``dst`` except those specified by ``first_exclude`` and ``args``.
2929

30-
This method works the same way as :symbol:`bson_copy_to_excluding_noinit`, except it takes a va_list. This method does not call :symbol:`bson_init` on ``dst``.
30+
Does **not** call :symbol:`bson_init` on ``dst``.
3131

3232
.. seealso::
3333

src/libbson/doc/bson_t.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ BSON document contains duplicate keys.
204204
bson_concat
205205
bson_copy
206206
bson_copy_to
207-
bson_copy_to_excluding
208207
bson_copy_to_excluding_noinit
209208
bson_copy_to_excluding_noinit_va
210209
bson_count_keys

src/libbson/src/bson/bson.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,22 +2184,6 @@ bson_copy_to_excluding_noinit_va (const bson_t *src, bson_t *dst, const char *fi
21842184
}
21852185

21862186

2187-
void
2188-
bson_copy_to_excluding (const bson_t *src, bson_t *dst, const char *first_exclude, ...)
2189-
{
2190-
va_list args;
2191-
2192-
BSON_ASSERT (src);
2193-
BSON_ASSERT (dst);
2194-
BSON_ASSERT (first_exclude);
2195-
2196-
bson_init (dst);
2197-
2198-
va_start (args, first_exclude);
2199-
bson_copy_to_excluding_noinit_va (src, dst, first_exclude, args);
2200-
va_end (args);
2201-
}
2202-
22032187
void
22042188
bson_copy_to_excluding_noinit (const bson_t *src, bson_t *dst, const char *first_exclude, ...)
22052189
{

src/libbson/src/bson/bson.h

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -288,31 +288,13 @@ bson_copy (const bson_t *bson);
288288
BSON_EXPORT (void)
289289
bson_copy_to (const bson_t *src, bson_t *dst);
290290

291-
292-
/**
293-
* bson_copy_to_excluding:
294-
* @src: A bson_t.
295-
* @dst: A bson_t to initialize and copy into.
296-
* @first_exclude: First field name to exclude.
297-
*
298-
* Copies @src into @dst excluding any field that is provided.
299-
* This is handy for situations when you need to remove one or
300-
* more fields in a bson_t. Note that bson_init() will be called
301-
* on dst.
302-
*/
303-
BSON_DEPRECATED_FOR (bson_copy_to_excluding_noinit)
304-
BSON_EXPORT (void)
305-
bson_copy_to_excluding (const bson_t *src, bson_t *dst, const char *first_exclude, ...) BSON_GNUC_NULL_TERMINATED;
306-
307291
/**
308292
* bson_copy_to_excluding_noinit:
309293
* @src: A bson_t.
310294
* @dst: A bson_t to initialize and copy into.
311295
* @first_exclude: First field name to exclude.
312296
*
313-
* The same as bson_copy_to_excluding, but does not call bson_init()
314-
* on the dst. This version should be preferred in new code, but the
315-
* old function is left for backwards compatibility.
297+
* Does not call bson_init() on the dst.
316298
*/
317299
BSON_EXPORT (void)
318300
bson_copy_to_excluding_noinit (const bson_t *src, bson_t *dst, const char *first_exclude, ...)

src/libmongoc/tests/json-test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,12 +1374,12 @@ set_auto_encryption_opts (mongoc_client_t *client, bson_t *test)
13741374
auto_encryption_opts = mongoc_auto_encryption_opts_new ();
13751375

13761376
if (bson_iter_init_find (&iter, &opts, "kmsProviders")) {
1377-
bson_t kms_providers;
1377+
bson_t kms_providers = BSON_INITIALIZER;
13781378
bson_t tls_opts = BSON_INITIALIZER;
13791379
bson_t tmp;
13801380

13811381
bson_iter_bson (&iter, &tmp);
1382-
bson_copy_to_excluding (
1382+
bson_copy_to_excluding_noinit (
13831383
&tmp, &kms_providers, "aws", "awsTemporary", "awsTemporaryNoSessionToken", "azure", "gcp", "kmip", NULL);
13841384

13851385
/* AWS credentials are set from environment variables. */

src/libmongoc/tests/test-mongoc-connection-uri.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ run_uri_test (const char *uri_string,
306306

307307
// CDRIVER-4128: CANONICALIZE_HOST_NAME is UTF-8 even when "false" or "true".
308308
{
309-
bson_t updated;
310-
bson_copy_to_excluding (&expected_props, &updated, "CANONICALIZE_HOST_NAME", NULL);
309+
bson_t updated = BSON_INITIALIZER;
310+
bson_copy_to_excluding_noinit (&expected_props, &updated, "CANONICALIZE_HOST_NAME", NULL);
311311
if (bson_iter_init_find_case (&iter, &expected_props, "CANONICALIZE_HOST_NAME")) {
312312
if (BSON_ITER_HOLDS_BOOL (&iter)) {
313313
BSON_APPEND_UTF8 (

src/libmongoc/tests/unified/operation.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4325,7 +4325,7 @@ operation_run (test_t *test, bson_t *op_bson, bson_error_t *error)
43254325
/* Check for a "session" argument in all operations, it can be
43264326
* an argument for any operation. */
43274327
if (op->arguments && bson_has_field (op->arguments, "session")) {
4328-
bson_t copied;
4328+
bson_t copied = BSON_INITIALIZER;
43294329
mongoc_client_session_t *session = NULL;
43304330

43314331
op->session_id = bson_strdup (bson_lookup_utf8 (op->arguments, "session"));
@@ -4335,7 +4335,7 @@ operation_run (test_t *test, bson_t *op_bson, bson_error_t *error)
43354335
goto done;
43364336
}
43374337

4338-
bson_copy_to_excluding (op->arguments, &copied, "session", NULL);
4338+
bson_copy_to_excluding_noinit (op->arguments, &copied, "session", NULL);
43394339
bson_destroy (op->arguments);
43404340
op->arguments = bson_copy (&copied);
43414341
bson_destroy (&copied);

0 commit comments

Comments
 (0)