Skip to content

Commit

Permalink
fix compiler warnings
Browse files Browse the repository at this point in the history
& remove redundant enum
  • Loading branch information
Komnomnomnom committed Jun 12, 2012
1 parent d041aba commit 79e9806
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 35 deletions.
2 changes: 1 addition & 1 deletion lib/ultrajsondec.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ FASTCALL_ATTR JSOBJ FASTCALL_MSVC decode_array( struct DecoderState *ds)

if ((*ds->start) == ']')
{
*ds->start ++;
ds->start++;
return newObj;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ultrajsonenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ int Buffer_EscapeStringUnvalidated (JSOBJ obj, JSONObjectEncoder *enc, const cha
default: (*of++) = (*io); break;
}

*io++;
io++;
}

return FALSE;
Expand Down
28 changes: 4 additions & 24 deletions python/objToJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,6 @@ typedef struct __TypeContext

#define GET_TC(__ptrtc) ((TypeContext *)((__ptrtc)->prv))


enum PRIVATE
{
PRV_CONV_FUNC, // Function pointer to converter function
PRV_CONV_NEWOBJ, // Any new PyObject created by converter function that should be released by releaseValue
PRV_ITER_BEGIN_FUNC, // Function pointer to iterBegin for specific type
PRV_ITER_END_FUNC, // Function pointer to iterEnd for specific type
PRV_ITER_NEXT_FUNC, // Function pointer to iterNext for specific type
PRV_ITER_GETVALUE_FUNC,
PRV_ITER_GETNAME_FUNC,
PRV_ITER_INDEX, // Index in the iteration list
PRV_ITER_SIZE, // Size of the iteration list
PRV_ITER_ITEM, // Current iter item
PRV_ITER_ITEM_NAME, // Name of iter item
PRV_ITER_ITEM_VALUE, // Value of iteritem
PRV_ITER_DICTITEMS,
PRV_ITER_DICTOBJ,
PRV_ITER_ATTRLIST,
};

struct PyDictIterState
{
PyObject *keys;
Expand All @@ -67,7 +47,7 @@ struct PyDictIterState
//#define PRINTMARK() fprintf(stderr, "%s: MARK(%d)\n", __FILE__, __LINE__)
#define PRINTMARK()

void initObjToJSON()
void initObjToJSON(void)
{
//FIXME: DECREF on these?
PyDateTime_IMPORT;
Expand Down Expand Up @@ -98,7 +78,6 @@ static void *PyIntToINT64(JSOBJ _obj, JSONTypeContext *tc, void *outValue, size_

static void *PyLongToINT64(JSOBJ _obj, JSONTypeContext *tc, void *outValue, size_t *_outLen)
{
PyObject *obj = (PyObject *) _obj;
*((JSINT64 *) outValue) = GET_TC(tc)->longValue;
return NULL;
}
Expand Down Expand Up @@ -416,8 +395,9 @@ char *Dict_iterGetName(JSOBJ obj, JSONTypeContext *tc, size_t *outLen)
}


void Object_beginTypeContext (PyObject *obj, JSONTypeContext *tc)
void Object_beginTypeContext (JSOBJ _obj, JSONTypeContext *tc)
{
PyObject* obj = (PyObject*) _obj;
TypeContext *pc = (TypeContext *) tc->prv;
PyObject *toDictFunc;

Expand Down Expand Up @@ -646,7 +626,7 @@ double Object_getDoubleValue(JSOBJ obj, JSONTypeContext *tc)
return ret;
}

static void Object_releaseObject(JSOBJ *_obj)
static void Object_releaseObject(JSOBJ _obj)
{
Py_DECREF( (PyObject *) _obj);
}
Expand Down
18 changes: 9 additions & 9 deletions python/ujson.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
#include "version.h"

/* objToJSON */
PyObject* objToJSON(PyObject* self, PyObject *arg);
void initObjToJSON();
PyObject* objToJSON(PyObject* self, PyObject *args, PyObject *kwargs);
void initObjToJSON(void);

/* JSONToObj */
PyObject* JSONToObj(PyObject* self, PyObject *arg);

/* objToJSONFile */
PyObject* objToJSONFile(PyObject* self, PyObject *args);
PyObject* objToJSONFile(PyObject* self, PyObject *args, PyObject *kwargs);

/* JSONFileToObj */
PyObject* JSONFileToObj(PyObject* self, PyObject *file);


static PyMethodDef ujsonMethods[] = {
{"encode", objToJSON, METH_VARARGS | METH_KEYWORDS, "Converts arbitrary object recursivly into JSON. Use ensure_ascii=false to output UTF-8. Pass in double_precision to alter the maximum digit precision with doubles"},
{"decode", JSONToObj, METH_O, "Converts JSON as string to dict object structure"},
{"dumps", objToJSON, METH_VARARGS | METH_KEYWORDS, "Converts arbitrary object recursivly into JSON. Use ensure_ascii=false to output UTF-8"},
{"loads", JSONToObj, METH_O, "Converts JSON as string to dict object structure"},
{"dump", objToJSONFile, METH_VARARGS | METH_KEYWORDS, "Converts arbitrary object recursively into JSON file. Use ensure_ascii=false to output UTF-8"},
{"load", JSONFileToObj, METH_O, "Converts JSON as file to dict object structure"},
{"encode", (PyCFunction) objToJSON, METH_VARARGS | METH_KEYWORDS, "Converts arbitrary object recursivly into JSON. Use ensure_ascii=false to output UTF-8. Pass in double_precision to alter the maximum digit precision with doubles"},
{"decode", (PyCFunction) JSONToObj, METH_O, "Converts JSON as string to dict object structure"},
{"dumps", (PyCFunction) objToJSON, METH_VARARGS | METH_KEYWORDS, "Converts arbitrary object recursivly into JSON. Use ensure_ascii=false to output UTF-8"},
{"loads", (PyCFunction) JSONToObj, METH_O, "Converts JSON as string to dict object structure"},
{"dump", (PyCFunction) objToJSONFile, METH_VARARGS | METH_KEYWORDS, "Converts arbitrary object recursively into JSON file. Use ensure_ascii=false to output UTF-8"},
{"load", (PyCFunction) JSONFileToObj, METH_O, "Converts JSON as file to dict object structure"},
{NULL, NULL, 0, NULL} /* Sentinel */
};

Expand Down

0 comments on commit 79e9806

Please sign in to comment.