akheron/jansson — pull request #140 by chipdude (2013-09-27 05:35:50+00:00)
Title: Support "\u0000" in strings

The support for "#" in pack, for the stated purpose of supporting null characters in strings, is incomplete in several serious ways:
No load support
No size_t support ("int" hasn't been big enough for a decade - printf is behind the times)
No string stealing support (half the mallocs for loading)
Even more seriously, some input errors throw assertions, which crashes programs. That's not OK in a production environment.

This patch addresses these issues:
Load works
The '%" character acts just like "#", but it expects size_t values
String stealing is in the API
Input errors become runtime errors, not program crashers.

This patch also fixes some cosmetic case consistency between dump and error messages; a few whitespace consistency issues; and a macro safety issue.

I'm happy to break this up into separate patches once we've discussed how they should look.