[CDRIVER-1173] Remove malloc for Decimal128 conversion during BSON->JSON Created: 24/Mar/16  Updated: 10/Aug/16  Resolved: 15/Jun/16

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.4.0

Type: Improvement Priority: Major - P3
Reporter: Hannes Magnusson Assignee: Fiona Rowan
Resolution: Done Votes: 0
Labels: intern2016
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-1145 Implement Decimal 128 type spec Closed

 Description   

Since bson_decimal128_from_string () requires a null terminated string, the BSON to JSON conversion for bson_decimal128_t allocates a new string+1 since the input isn't null terminated.

We should be able to avoid that extra malloc, either though stack allocation or passing the length to the bson_decimal128_from_string () function.



 Comments   
Comment by Githook User [ 15/Jun/16 ]

Author:

{u'username': u'fionaRowan', u'name': u'Fiona Rowan', u'email': u'fmr2112@columbia.edu'}

Message: CDRIVER-1173 remove malloc for Decimal128 conversion (#161)
Branch: master
https://github.com/mongodb/libbson/commit/69caa4bf40165586bc9f086567524dd0d350d927

Comment by Fiona Rowan [ 06/Jun/16 ]

this is in _bson_json_read_string () in bson-json.c

Comment by A. Jesse Jiryu Davis [ 06/Jun/16 ]

Small optimization in libbson.

Generated at Wed Feb 07 21:11:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.