Skip to content

Commit 2b2a374

Browse files
authored
CDRIVER-3361 update documentation for owning return values (#863)
1 parent 52a8237 commit 2b2a374

6 files changed

+33
-4
lines changed

src/libmongoc/doc/mongoc_session_opts_clone.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ Parameters
1919

2020
* ``opts``: A :symbol:`mongoc_session_opt_t`.
2121

22+
Returns
23+
-------
24+
25+
A new :symbol:`mongoc_session_opt_t` that must be freed with :symbol:`mongoc_session_opts_destroy()`.
26+
2227
.. only:: html
2328

2429
.. include:: includes/seealso/session.txt

src/libmongoc/doc/mongoc_session_opts_get_default_transaction_opts.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@ Synopsis
1111
const mongoc_transaction_opt_t *
1212
mongoc_session_opts_get_default_transaction_opts (const mongoc_session_opt_t *opts);
1313
14-
The default options for transactions started with this session. The returned value is valid only for the lifetime of ``opts``. See :symbol:`mongoc_session_opts_set_default_transaction_opts()`.
14+
The default options for transactions started with this session.
1515

1616
Parameters
1717
----------
1818

1919
* ``opts``: A :symbol:`mongoc_session_opt_t`.
2020

21+
Returns
22+
-------
23+
24+
A :symbol:`mongoc_transaction_opt_t` which should not be modified or freed.
25+
26+
See :symbol:`mongoc_session_opts_set_default_transaction_opts()`.
27+
2128
.. only:: html
2229

2330
.. include:: includes/seealso/session.txt

src/libmongoc/doc/mongoc_session_opts_get_transaction_opts.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ Synopsis
1212
mongoc_session_opts_get_transaction_opts (
1313
const mongoc_client_session_t *session) BSON_GNUC_WARN_UNUSED_RESULT;
1414
15-
The options for the current transaction started with this session. The resulting :symbol:`mongoc_transaction_opt_t` should be freed with :symbol:`mongoc_transaction_opts_destroy`. If this ``session`` is not in a transaction, then the returned value is ``NULL``. See :symbol:`mongoc_client_session_in_transaction()`.
15+
The options for the current transaction started with this session.
16+
17+
If this ``session`` is not in a transaction, then the returned value is ``NULL``. See :symbol:`mongoc_client_session_in_transaction()`.
1618

1719
Parameters
1820
----------
@@ -22,7 +24,7 @@ Parameters
2224
Returns
2325
-------
2426

25-
A newly allocated :symbol:`mongoc_transaction_opt_t` that should be freed with :symbol:`mongoc_transaction_opts_destroy` or ``NULL`` if the session is not in a transaction.
27+
If the session is in a transaction, a new :symbol:`mongoc_transaction_opt_t` that must be freed with :symbol:`mongoc_transaction_opts_destroy()`. Otherwise, ``NULL``.
2628

2729
.. only:: html
2830

src/libmongoc/doc/mongoc_session_opts_new.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ Synopsis
1515

1616
See the example code for :symbol:`mongoc_session_opts_set_causal_consistency`.
1717

18+
Returns
19+
-------
20+
21+
A new :symbol:`mongoc_session_opt_t` that must be freed with :symbol:`mongoc_session_opts_destroy()`.
22+
1823
.. only:: html
1924

2025
.. include:: includes/seealso/session.txt

src/libmongoc/doc/mongoc_transaction_opts_clone.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ Parameters
1919

2020
* ``opts``: A :symbol:`mongoc_transaction_opt_t`.
2121

22+
Returns
23+
-------
24+
25+
A new :symbol:`mongoc_transaction_opt_t` that must be freed with :symbol:`mongoc_transaction_opts_destroy()`.
26+
2227
.. only:: html
2328

2429
.. include:: includes/seealso/session.txt

src/libmongoc/doc/mongoc_transaction_opts_new.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ Synopsis
1111
mongoc_transaction_opt_t *
1212
mongoc_transaction_opts_new (void);
1313
14-
Create a :symbol:`mongoc_transaction_opt_t` to configure multi-document transactions. The struct must be freed with :symbol:`mongoc_transaction_opts_destroy`.
14+
Create a :symbol:`mongoc_transaction_opt_t` to configure multi-document transactions.
15+
16+
Returns
17+
-------
18+
19+
A new :symbol:`mongoc_transaction_opt_t` that must be freed with :symbol:`mongoc_transaction_opts_destroy()`.
1520

1621
.. only:: html
1722

0 commit comments

Comments
 (0)