Refactor json_pack()
authorPetri Lehtinen <petri@digip.org>
Sun, 23 Jan 2011 19:14:19 +0000 (21:14 +0200)
committerPetri Lehtinen <petri@digip.org>
Mon, 24 Jan 2011 19:26:23 +0000 (21:26 +0200)
commit7f3018a4fb547a10ce250db91ec0d41b0cc57bf2
treead57f2e738de5b04b8516990d41d04ef4d4b8eea
parent53383860e804d1e4f6e038a2c76461867b1ef497
Refactor json_pack()

* Implement a "scanner" that reads the format string, maintaining state

* Split json_vnpack() to three separate functions for packing objects,
  arrays and simple values. This makes it more clear what is being
  packed, and the object and array structures become more evident.

* Make the skipping of ignored character simpler, i.e. skip ':' and
  ',' independent of their context

This patch shaves around 80 lines of code from the original
implementation.
src/error.c
src/jansson_private.h
src/variadic.c
test/suites/api/test_pack.c