Yodiwo / YodiwoPlegma
Revision:
3:96b08b5f998f
Parent:
2:855390040d43
Child:
4:073e23f6718c
diff -r 855390040d43 -r 96b08b5f998f yodiwo_helpers.c
--- a/yodiwo_helpers.c	Tue Sep 08 11:08:03 2015 +0000
+++ b/yodiwo_helpers.c	Tue Sep 15 10:21:40 2015 +0000
@@ -71,9 +71,12 @@
 int Parse_String(jsmntok_t* t, char* json, void** result)
 {
 	int s = t->end - t->start;
-	*result = os_zmalloc(sizeof(char)*(s + 1));
+	int escaped = count_escaped(&json[t->start], s);
+	printf("total: %d\n", s);
+	printf("escaped: %d\n", escaped);
+	*result = os_zmalloc(sizeof(char)*(s - escaped + 1));
 	if (*result != NULL)
-		memcpy(*result, &json[t->start], s);
+		memcpy_unescaped(*result, &json[t->start], s);
 	return 1;
 }
 // -----------------------------------------------------------------------------------------------------------------------