@@ -984,7 +984,7 @@ static char *List_iterGetName(JSOBJ Py_UNUSED(obj),
984
984
//=============================================================================
985
985
static void Index_iterBegin (JSOBJ Py_UNUSED (obj ), JSONTypeContext * tc ) {
986
986
GET_TC (tc )-> index = 0 ;
987
- GET_TC (tc )-> cStr = PyObject_Malloc (20 * sizeof ( char ) );
987
+ GET_TC (tc )-> cStr = PyObject_Malloc (20 );
988
988
if (!GET_TC (tc )-> cStr ) {
989
989
PyErr_NoMemory ();
990
990
}
@@ -998,10 +998,10 @@ static int Index_iterNext(JSOBJ obj, JSONTypeContext *tc) {
998
998
const Py_ssize_t index = GET_TC (tc )-> index ;
999
999
Py_XDECREF (GET_TC (tc )-> itemValue );
1000
1000
if (index == 0 ) {
1001
- memcpy (GET_TC (tc )-> cStr , "name" , sizeof ( char ) * 5 );
1001
+ memcpy (GET_TC (tc )-> cStr , "name" , 5 );
1002
1002
GET_TC (tc )-> itemValue = PyObject_GetAttrString (obj , "name" );
1003
1003
} else if (index == 1 ) {
1004
- memcpy (GET_TC (tc )-> cStr , "data" , sizeof ( char ) * 5 );
1004
+ memcpy (GET_TC (tc )-> cStr , "data" , 5 );
1005
1005
GET_TC (tc )-> itemValue = get_values (obj );
1006
1006
if (!GET_TC (tc )-> itemValue ) {
1007
1007
return 0 ;
@@ -1033,7 +1033,7 @@ static char *Index_iterGetName(JSOBJ Py_UNUSED(obj), JSONTypeContext *tc,
1033
1033
static void Series_iterBegin (JSOBJ Py_UNUSED (obj ), JSONTypeContext * tc ) {
1034
1034
PyObjectEncoder * enc = (PyObjectEncoder * )tc -> encoder ;
1035
1035
GET_TC (tc )-> index = 0 ;
1036
- GET_TC (tc )-> cStr = PyObject_Malloc (20 * sizeof ( char ) );
1036
+ GET_TC (tc )-> cStr = PyObject_Malloc (20 );
1037
1037
enc -> outputFormat = VALUES ; // for contained series
1038
1038
if (!GET_TC (tc )-> cStr ) {
1039
1039
PyErr_NoMemory ();
@@ -1048,13 +1048,13 @@ static int Series_iterNext(JSOBJ obj, JSONTypeContext *tc) {
1048
1048
const Py_ssize_t index = GET_TC (tc )-> index ;
1049
1049
Py_XDECREF (GET_TC (tc )-> itemValue );
1050
1050
if (index == 0 ) {
1051
- memcpy (GET_TC (tc )-> cStr , "name" , sizeof ( char ) * 5 );
1051
+ memcpy (GET_TC (tc )-> cStr , "name" , 5 );
1052
1052
GET_TC (tc )-> itemValue = PyObject_GetAttrString (obj , "name" );
1053
1053
} else if (index == 1 ) {
1054
- memcpy (GET_TC (tc )-> cStr , "index" , sizeof ( char ) * 6 );
1054
+ memcpy (GET_TC (tc )-> cStr , "index" , 6 );
1055
1055
GET_TC (tc )-> itemValue = PyObject_GetAttrString (obj , "index" );
1056
1056
} else if (index == 2 ) {
1057
- memcpy (GET_TC (tc )-> cStr , "data" , sizeof ( char ) * 5 );
1057
+ memcpy (GET_TC (tc )-> cStr , "data" , 5 );
1058
1058
GET_TC (tc )-> itemValue = get_values (obj );
1059
1059
if (!GET_TC (tc )-> itemValue ) {
1060
1060
return 0 ;
@@ -1088,7 +1088,7 @@ static char *Series_iterGetName(JSOBJ Py_UNUSED(obj), JSONTypeContext *tc,
1088
1088
static void DataFrame_iterBegin (JSOBJ Py_UNUSED (obj ), JSONTypeContext * tc ) {
1089
1089
PyObjectEncoder * enc = (PyObjectEncoder * )tc -> encoder ;
1090
1090
GET_TC (tc )-> index = 0 ;
1091
- GET_TC (tc )-> cStr = PyObject_Malloc (20 * sizeof ( char ) );
1091
+ GET_TC (tc )-> cStr = PyObject_Malloc (20 );
1092
1092
enc -> outputFormat = VALUES ; // for contained series & index
1093
1093
if (!GET_TC (tc )-> cStr ) {
1094
1094
PyErr_NoMemory ();
@@ -1103,13 +1103,13 @@ static int DataFrame_iterNext(JSOBJ obj, JSONTypeContext *tc) {
1103
1103
const Py_ssize_t index = GET_TC (tc )-> index ;
1104
1104
Py_XDECREF (GET_TC (tc )-> itemValue );
1105
1105
if (index == 0 ) {
1106
- memcpy (GET_TC (tc )-> cStr , "columns" , sizeof ( char ) * 8 );
1106
+ memcpy (GET_TC (tc )-> cStr , "columns" , 8 );
1107
1107
GET_TC (tc )-> itemValue = PyObject_GetAttrString (obj , "columns" );
1108
1108
} else if (index == 1 ) {
1109
- memcpy (GET_TC (tc )-> cStr , "index" , sizeof ( char ) * 6 );
1109
+ memcpy (GET_TC (tc )-> cStr , "index" , 6 );
1110
1110
GET_TC (tc )-> itemValue = PyObject_GetAttrString (obj , "index" );
1111
1111
} else if (index == 2 ) {
1112
- memcpy (GET_TC (tc )-> cStr , "data" , sizeof ( char ) * 5 );
1112
+ memcpy (GET_TC (tc )-> cStr , "data" , 5 );
1113
1113
Py_INCREF (obj );
1114
1114
GET_TC (tc )-> itemValue = obj ;
1115
1115
} else {
0 commit comments