summaryrefslogtreecommitdiff
path: root/src/json.c
diff options
context:
space:
mode:
authorAlan Third <alan@idiocy.org>2018-08-11 14:37:37 +0100
committerAlan Third <alan@idiocy.org>2018-08-11 14:37:37 +0100
commite39f975ee9e0b9f3682ee4b86800821d2e40aaa8 (patch)
tree213a0f3172d10f941a03cbea578d6188c8dbd320 /src/json.c
parentef1abd99fafc9177058438cdf84776441ce62fc5 (diff)
parent914b0300bcca8ac016b85df54ed36c98d07c74a7 (diff)
downloademacs-scratch/ns-drawing.tar.gz
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into ns-drawingscratch/ns-drawing
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/json.c b/src/json.c
index afdd9a25481..540aa630c59 100644
--- a/src/json.c
+++ b/src/json.c
@@ -159,7 +159,12 @@ init_json_functions (void)
than PTRDIFF_MAX. Such objects wouldn't play well with the rest of
Emacs's codebase, which generally uses ptrdiff_t for sizes and
indices. The other functions in this file also generally assume
- that size_t values never exceed PTRDIFF_MAX. */
+ that size_t values never exceed PTRDIFF_MAX.
+
+ In addition, we need to use a custom allocator because on
+ MS-Windows we replace malloc/free with our own functions, see
+ w32heap.c, so we must force the library to use our allocator, or
+ else we won't be able to free storage allocated by the library. */
static void *
json_malloc (size_t size)
@@ -605,7 +610,7 @@ usage: (json-serialize OBJECT &rest ARGS) */)
char *string = json_dumps (json, JSON_COMPACT);
if (string == NULL)
json_out_of_memory ();
- record_unwind_protect_ptr (free, string);
+ record_unwind_protect_ptr (json_free, string);
return unbind_to (count, json_build_string (string));
}