Skip to content

Instantly share code, notes, and snippets.

@mumumu
Created May 16, 2015 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mumumu/58f6e501e079eb1d59a8 to your computer and use it in GitHub Desktop.
Save mumumu/58f6e501e079eb1d59a8 to your computer and use it in GitHub Desktop.
diff --git a/python/JSONtoObj.c b/python/JSONtoObj.c
index 79d9f1a..610367b 100644
--- a/python/JSONtoObj.c
+++ b/python/JSONtoObj.c
@@ -136,9 +136,9 @@ PyObject* JSONToObj(PyObject* self, PyObject *args, PyObject *kwargs)
Object_newUnsignedLong,
Object_newDouble,
Object_releaseObject,
- PyObject_Malloc,
- PyObject_Free,
- PyObject_Realloc
+ malloc,
+ free,
+ realloc
};
decoder.preciseFloat = 0;
diff --git a/python/objToJSON.c b/python/objToJSON.c
index a78f3c9..d9c586a 100644
--- a/python/objToJSON.c
+++ b/python/objToJSON.c
@@ -634,7 +634,7 @@ void Object_beginTypeContext (JSOBJ _obj, JSONTypeContext *tc, JSONObjectEncoder
obj = (PyObject*) _obj;
- tc->prv = PyObject_Malloc(sizeof(TypeContext));
+ tc->prv = enc->malloc(sizeof(TypeContext));
pc = (TypeContext *) tc->prv;
if (!pc)
{
@@ -873,7 +873,7 @@ ISITERABLE:
INVALID:
PRINTMARK();
tc->type = JT_INVALID;
- PyObject_Free(tc->prv);
+ enc->free(tc->prv);
tc->prv = NULL;
return;
}
@@ -882,7 +882,7 @@ void Object_endTypeContext(JSOBJ obj, JSONTypeContext *tc)
{
Py_XDECREF(GET_TC(tc)->newObj);
- PyObject_Free(tc->prv);
+ free(tc->prv);
tc->prv = NULL;
}
@@ -971,9 +971,9 @@ PyObject* objToJSON(PyObject* self, PyObject *args, PyObject *kwargs)
Object_iterGetValue,
Object_iterGetName,
Object_releaseObject,
- PyObject_Malloc,
- PyObject_Realloc,
- PyObject_Free,
+ malloc,
+ realloc,
+ free,
-1, //recursionMax
10, // default double precision setting
1, //forceAscii
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment