mirror of
https://github.com/json-c/json-c.git
synced 2026-04-04 12:59:07 +08:00
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%.
This commit is contained in:
@@ -18,5 +18,16 @@ Partial append: 3, [blu]
|
||||
With embedded \0 character: 4, [ab]
|
||||
Append to just before resize: 31, [XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX]
|
||||
Append to just after resize: 32, [XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX]
|
||||
Buffer size after printbuf_strappend(): 16, [XXXXXXXXXXXXXXXX]
|
||||
test_printbuf_memappend: end test
|
||||
========================================
|
||||
test_sprintbuf: starting test
|
||||
Buffer length: 0
|
||||
sprintbuf to just after resize(31+1): 32, [XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX], strlen(buf)=32
|
||||
5, [plain]
|
||||
6, [plain1]
|
||||
16, [plain12147483647]
|
||||
27, [plain12147483647-2147483648]
|
||||
29, [plain12147483647-2147483648%s]
|
||||
test_sprintbuf: end test
|
||||
========================================
|
||||
|
||||
Reference in New Issue
Block a user