summaryrefslogtreecommitdiffstats
path: root/lib/buffer.c
Commit message (Collapse)AuthorAgeFilesLines
* Reduce the number of memory allocationsGergely Nagy2012-04-291-14/+32
| | | | | | | | Make the string escape use an ul_buffer_t, to avoid unnecessary memory allocations. This greatly reduces the number of mallocs made, and thus results in a noticable increase in speed. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* Improve string escape performance a littleGergely Nagy2012-04-161-6/+5
| | | | | | | | | | Instead of escaping a string, returning a new one and running strlen() on that, use an output variable to store the length, since we can easily calculate that during the escape process anyway. This should shave off a tiny bit of CPU time. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Correctly NULL-terminate the JSON buffer in all cases.Gergely Nagy2012-04-131-1/+1
| | | | | | | When finalizing the JSON buffer, always NULL-terminate it at the appropriate length. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Implement string escaping.Gergely Nagy2012-04-131-7/+132
| | | | | | With this patch, both JSON keys and values will be properly escaped. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Fix ul_buffer_finalize().Gergely Nagy2012-04-131-2/+3
| | | | | | | ul_buffer_finalize() was off by one, and instead of overriding the trailing ",", it overwrote the trailing nul-byte. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Format JSON ourselves, without json-c.Gergely Nagy2012-04-131-0/+94
To make the library thinner, we now format JSON ourselves: there was so little we used from json-c, that doing it ourselves is lighter and faster. With this commit, we have the architecture in place, with only a few little things remaining to be done, such as escaping string values. Signed-off-by: Gergely Nagy <algernon@balabit.hu>