Closed azadkuh closed 10 years ago
No it's not. User is smart enough to care about memory. Parser just parsing, instead solving memory management issues
definitely users are smart!
one of the key Characteristics of a Good API is Hard to misuse regardless of users intelligence.
because they are focused on their own logic / application and they may have no time to fully understand your great implementation.
another approach:
jsonParse()
can return an error status code if allocator
is already allocated.
In allocator maybe allocated buffer for copy of source buffer or something similar
it's better to add:
to the bigining of
jsonParse()
to stopallocator
instance growing every time if the instance has been used before.users may forget to call
deallocate()
or introduce a new instance ofallocator
every time they calljsonParse()
.