1
0
Fork 0
mirror of https://github.com/ultrajson/ultrajson.git synced 2024-05-29 02:26:09 +02:00

Minor performance optimization

This commit is contained in:
Jonas Tarnstrom 2014-04-14 15:52:22 +02:00
parent 4057771d9c
commit 510a8fc6d7
3 changed files with 4 additions and 4 deletions

View File

@ -161,8 +161,11 @@ enum JSTYPES
typedef void * JSOBJ;
typedef void * JSITER;
#define JSON_TYPECONTEXT_PRIVATE_BUFFER_SIZE 128
typedef struct __JSONTypeContext
{
JSUINT8 prvBuffer[JSON_TYPECONTEXT_PRIVATE_BUFFER_SIZE];
int type;
void *prv;
void *encoder_prv;

View File

@ -714,6 +714,7 @@ void encode(JSOBJ obj, JSONObjectEncoder *enc, const char *name, size_t cbName)
}
tc.encoder_prv = enc->prv;
tc.prv = (void *) tc.prvBuffer;
enc->beginTypeContext(obj, &tc);
switch (tc.type)

View File

@ -492,7 +492,6 @@ void Object_beginTypeContext (JSOBJ _obj, JSONTypeContext *tc)
obj = (PyObject*) _obj;
tc->prv = PyObject_Malloc(sizeof(TypeContext));
pc = (TypeContext *) tc->prv;
if (!pc)
{
@ -726,9 +725,6 @@ INVALID:
void Object_endTypeContext(JSOBJ obj, JSONTypeContext *tc)
{
Py_XDECREF(GET_TC(tc)->newObj);
PyObject_Free(tc->prv);
tc->prv = NULL;
}
const char *Object_getStringValue(JSOBJ obj, JSONTypeContext *tc, size_t *_outLen)