1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Move from Jansson to JV - everything but the interpreter loop

Passes valgrind --leak-check=full.
This commit is contained in:
Stephen Dolan
2012-09-02 16:31:59 +01:00
parent 22f8aed31e
commit 2cb9a6e61d
12 changed files with 170 additions and 123 deletions

6
c/jv.c
View File

@@ -278,7 +278,7 @@ static jvp_string* jvp_string_alloc(uint32_t size) {
return s;
}
static jv_complex jvp_string_new(char* data, uint32_t length) {
static jv_complex jvp_string_new(const char* data, uint32_t length) {
jvp_string* s = jvp_string_alloc(length);
memcpy(s->data, data, length);
s->data[length] = 0;
@@ -389,14 +389,14 @@ static int jvp_string_equal(jv_complex* a, jv_complex* b) {
* Strings (public API)
*/
jv jv_string_sized(char* str, int len) {
jv jv_string_sized(const char* str, int len) {
jv j;
j.kind = JV_KIND_STRING;
j.val.complex = jvp_string_new(str, len);
return j;
}
jv jv_string(char* str) {
jv jv_string(const char* str) {
return jv_string_sized(str, strlen(str));
}