<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:18:19 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CDRIVER-3526] Proposal for bson_init_static_from_buffer</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-3526</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;I would suggest adding a new API function, bson_init_static_from_buffer which is similar in most ways to bson_new_from_buffer, and in others to bson_init_static, but differs from the latter in that the buffer supplied is not read-only, and from the former in that it does not actually allocate the bson, but instead takes a pointer to one as an extra initial parameter and returns with the bson initialized so that appending to it will utilize the realloc function supplied with the allocation context as a parameter.&#160;&#160;&lt;/p&gt;

&lt;p&gt;To that end, the prototype would probably look something like this:&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; bson_init_static_from_buffer (bson_t *bson, uint8_t **buf, size_t *buf_len, bson_realloc_func realloc_func, &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; *realloc_func_ctx)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Behaviour for this function would be virtually identical to that of bson_new_from_buffer except that it does not allocate the bson_t, and it sets up the bson so that calling bson_destroy does not attempt to free it, nor does it try to free the buffer it points to.&#160; It would, however, if `realloc_func` was not null,&#160;call the reallocation function with the current buffer and a size of 0, which bears the responsibility of freeing the memory used.&lt;/p&gt;

&lt;p&gt;The most obvious use case for such a function would be to allow each bson to have its own memory allocator (presumably accessed via the realloc_func_ctx pointer) without imposing the requirement that all bsons obtain their memory from a single pool, as&#160; bson_set_mem_vtable does currently.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1138968">CDRIVER-3526</key>
            <summary>Proposal for bson_init_static_from_buffer</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="5" iconUrl="https://jira.mongodb.org/images/icons/priorities/trivial.svg">Trivial - P5</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="markt1964@gmail.com">Mark Tarrabain</reporter>
                        <labels>
                            <label>bg-rf</label>
                            <label>neweng</label>
                    </labels>
                <created>Fri, 7 Feb 2020 17:09:50 +0000</created>
                <updated>Mon, 5 Feb 2024 19:48:39 +0000</updated>
                                                                            <component>libbson</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3857475" author="markt1964@gmail.com" created="Thu, 3 Jun 2021 14:53:02 +0000"  >&lt;p&gt;It has since occurred to me that using the term &apos;static&apos; in the name might be misleading... perhaps bson_init_from_buffer would be adequate.&#160; &#160;Paralleling bson_init in naming convention while using most of the same parameters as bson_new_from_buffer, and at the same time not implying that the buffer is supposed to be static and unchanging.&lt;/p&gt;</comment>
                            <comment id="2856574" author="april.schoffer" created="Mon, 10 Feb 2020 15:45:57 +0000"  >&lt;p&gt;We&apos;ll aim to put this in 1.17 pending scheduling of other priorities.&#160;&lt;/p&gt;</comment>
                            <comment id="2841551" author="jmikola@gmail.com" created="Fri, 7 Feb 2020 19:53:55 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=markt1964%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;markt1964@gmail.com&quot;&gt;markt1964@gmail.com&lt;/a&gt;: No worries, as &quot;major&quot; is the default selection. We can always adjust during the next triage meeting.&lt;/p&gt;</comment>
                            <comment id="2839453" author="markt1964@gmail.com" created="Fri, 7 Feb 2020 17:14:10 +0000"  >&lt;p&gt;I did not intend for the &quot;priority&quot; for this request to be listed as &quot;Major&quot;.&#160; I apologize profusely for the misunderstanding, and I can respect that this issue would be de-escalated appropriately.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>CDRIVER-3870</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hwd5nj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>