Commit Graph
13 Commits
Author SHA1 Message Date
Darren Carreras 62bb838c57 printbuf: preserve self-append sources across growth
When the appended data points into the printbuf itself, growing the buffer may invalidate the source pointer before it is copied. Preserve the source offset across realloc and use memmove for internal overlap.
2026-08-01 14:12:56 -04:00
Khem Raj 6eca65617a Fix build with clang-15+
Fixes
json_util.c:63:35: error: a function declaration without a prototype is deprecated in all versions of C [-We
rror,-Wstrict-prototypes]
const char *json_util_get_last_err()
                                  ^
                                   void

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2022-08-13 20:47:20 -07:00
Eric Haszlakiewicz 49c3721a5a Unset NDEBUG so assert() is enabled in all tests. One more fix there when building with -DCMAKE_BUILD_TYPE=release. 2022-05-30 15:39:54 +00:00
dota17 8b162c4b89 clang-format the files 2020-04-03 11:39:30 +08:00
chenguoping 8c0cb0bd28 Increased the test coverage of printbuf.c 82% to 92%. 2020-01-03 14:34:35 +08:00
Eric Haszlakiewicz 7f30afc6e5 Fix some Windows compile issues, add JSON_EXPORT's, fix bogus character escapes, define __func__ and omit unistd.h if needed. 2019-11-23 20:31:14 -05:00
Quentin Young f6f852fd93 Restore sprintbuf(), add macro for string literals
Hawciz pointed out that the previous commit modifies the public
interface of printbuf. Per his suggestion, sprintbuf() was restored
and a new pair of macros was added that wraps printbuf_memappend().

Using a wrapper macro instead of modifying sprintbuf() also reduces
function call overhead, bringing total performance gains to
approximately 400%.
2017-02-04 01:02:00 +00:00
Quentin Young 9ff0f4987f Improve json_object -> string performance
Removes variadic prints for ~3x performance improvement.
2017-02-02 17:33:54 +00:00
Eric Haszlakiewicz ca8b27d183 Enable -Werror and fix a number of minor warnings that existed. 2013-02-09 16:35:24 -06:00
Eric Haszlakiewicz 447b88a115 Fix a memory leak in the test_printbuf test. 2012-11-29 13:29:55 -06:00
Eric Haszlakiewicz c3068bfd09 Reformat the test sources. No functional change. 2012-09-16 20:43:29 -05:00
Mateusz Loskot 984303dfe5 Added a bunch of missing HAVE_* defines tested with ./configure script to fix compilation on Linux with GCC 4.7.1. The issue likely caused by my previous commits related to Visual C++ port of the code. 2012-06-19 20:15:44 +01:00
Eric Haszlakiewicz e5c1e87f05 Add a test for the printbuf functions. 2012-04-22 14:13:01 -05:00