mirror of
https://github.com/ultrajson/ultrajson.git
synced 2024-12-04 06:38:23 +01:00
Remove dead code that used to handle the separate int type in Python 2
This commit is contained in:
parent
fbae6a31ce
commit
f9aa23b5e6
@ -198,7 +198,6 @@ typedef struct __JSONObjectEncoder
|
||||
const char *(*getStringValue)(JSOBJ obj, JSONTypeContext *tc, size_t *_outLen);
|
||||
JSINT64 (*getLongValue)(JSOBJ obj, JSONTypeContext *tc);
|
||||
JSUINT64 (*getUnsignedLongValue)(JSOBJ obj, JSONTypeContext *tc);
|
||||
JSINT32 (*getIntValue)(JSOBJ obj, JSONTypeContext *tc);
|
||||
double (*getDoubleValue)(JSOBJ obj, JSONTypeContext *tc);
|
||||
|
||||
/*
|
||||
|
@ -518,22 +518,6 @@ static void Buffer_AppendIndentUnchecked(JSONObjectEncoder *enc, JSINT32 value)
|
||||
Buffer_AppendCharUnchecked(enc, ' ');
|
||||
}
|
||||
|
||||
static void Buffer_AppendIntUnchecked(JSONObjectEncoder *enc, JSINT32 value)
|
||||
{
|
||||
char* wstr;
|
||||
JSUINT32 uvalue = (value < 0) ? -value : value;
|
||||
|
||||
wstr = enc->offset;
|
||||
// Conversion. Number is reversed.
|
||||
|
||||
do *wstr++ = (char)(48 + (uvalue % 10)); while(uvalue /= 10);
|
||||
if (value < 0) *wstr++ = '-';
|
||||
|
||||
// Reverse string
|
||||
strreverse(enc->offset,wstr - 1);
|
||||
enc->offset += (wstr - (enc->offset));
|
||||
}
|
||||
|
||||
static void Buffer_AppendLongUnchecked(JSONObjectEncoder *enc, JSINT64 value)
|
||||
{
|
||||
char* wstr;
|
||||
@ -771,12 +755,6 @@ static void encode(JSOBJ obj, JSONObjectEncoder *enc, const char *name, size_t c
|
||||
break;
|
||||
}
|
||||
|
||||
case JT_INT:
|
||||
{
|
||||
Buffer_AppendIntUnchecked (enc, enc->getIntValue(obj, &tc));
|
||||
break;
|
||||
}
|
||||
|
||||
case JT_TRUE:
|
||||
{
|
||||
Buffer_AppendCharUnchecked (enc, 't');
|
||||
|
@ -88,22 +88,6 @@ struct PyDictIterState
|
||||
//#define PRINTMARK() fprintf(stderr, "%s: MARK(%d)\n", __FILE__, __LINE__)
|
||||
#define PRINTMARK()
|
||||
|
||||
#ifdef _LP64
|
||||
static void *PyIntToINT64(JSOBJ _obj, JSONTypeContext *tc, void *outValue, size_t *_outLen)
|
||||
{
|
||||
PyObject *obj = (PyObject *) _obj;
|
||||
*((JSINT64 *) outValue) = PyLong_AsLong (obj);
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
static void *PyIntToINT32(JSOBJ _obj, JSONTypeContext *tc, void *outValue, size_t *_outLen)
|
||||
{
|
||||
PyObject *obj = (PyObject *) _obj;
|
||||
*((JSINT32 *) outValue) = PyLong_AsLong (obj);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void *PyLongToINT64(JSOBJ _obj, JSONTypeContext *tc, void *outValue, size_t *_outLen)
|
||||
{
|
||||
*((JSINT64 *) outValue) = GET_TC(tc)->longValue;
|
||||
@ -521,17 +505,6 @@ BEGIN:
|
||||
return;
|
||||
}
|
||||
else
|
||||
if (PyLong_Check(obj))
|
||||
{
|
||||
PRINTMARK();
|
||||
#ifdef _LP64
|
||||
pc->PyTypeToJSON = PyIntToINT64; tc->type = JT_LONG;
|
||||
#else
|
||||
pc->PyTypeToJSON = PyIntToINT32; tc->type = JT_INT;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else
|
||||
if (UNLIKELY(PyBytes_Check(obj)))
|
||||
{
|
||||
PRINTMARK();
|
||||
@ -741,14 +714,6 @@ static JSUINT64 Object_getUnsignedLongValue(JSOBJ obj, JSONTypeContext *tc)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static JSINT32 Object_getIntValue(JSOBJ obj, JSONTypeContext *tc)
|
||||
{
|
||||
JSINT32 ret;
|
||||
obj = GET_OBJ(obj, tc);
|
||||
GET_TC(tc)->PyTypeToJSON (obj, tc, &ret, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static double Object_getDoubleValue(JSOBJ obj, JSONTypeContext *tc)
|
||||
{
|
||||
double ret;
|
||||
@ -810,7 +775,6 @@ PyObject* objToJSON(PyObject* self, PyObject *args, PyObject *kwargs)
|
||||
Object_getStringValue,
|
||||
Object_getLongValue,
|
||||
Object_getUnsignedLongValue,
|
||||
Object_getIntValue,
|
||||
Object_getDoubleValue,
|
||||
Object_iterNext,
|
||||
Object_iterEnd,
|
||||
|
Loading…
Reference in New Issue
Block a user