A backend engineer at @profusion, and a hobbyist C developer at @Cogmasters!
lcsmuller / json-build Goto Github PK
View Code? Open in Web Editor NEWTiny, zero-allocation JSON serializer written in ANSI C
License: MIT License
Tiny, zero-allocation JSON serializer written in ANSI C
License: MIT License
A backend engineer at @profusion, and a hobbyist C developer at @Cogmasters!
GCC version 10.2.1
The _jsonb_escape
function returns a log, but this is assigned to a jsonbcode
eum value in the calling routines.
It isn't always possible to add a compilation flag to allow this, as the compiler error suggests:
json-build/json-build.h:406:28: error: invalid conversion from 'long int' to 'jsonbcode' [-fpermissive]
406 | ret = _jsonb_escape(&pos, buf + b->pos, bufsize - b->pos, key, len);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long int
Hi!
We are using your amazing library and found a potential mem leak. I'm not sure the patch we prepared to solve it is good though:
Seems like _jsonb_escape was using the complete bufsize but buf was passed as buf + b->pos. So could _jsonb_escape be writing beyond the limits of buf?
To give some context, we are allocating an initial buffer that we resize if any of the build functions return JSONB_ERROR_NOMEM.
Hello,
I could not find a better way to ask a question about some implementation details in jsonb_init(), from jason-build.
What is the purpose of the following code:
void
jsonb_init(jsonb *b)
{
static jsonb empty_builder;
*b = empty_builder;
....
Thanks in advance.
Volodimir
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.