1124 return &cx_json_value_nothing; |
1124 return &cx_json_value_nothing; |
1125 } |
1125 } |
1126 return value->value.array.array[index]; |
1126 return value->value.array.array[index]; |
1127 } |
1127 } |
1128 |
1128 |
|
1129 CxJsonValue *cxJsonArrRemove(CxJsonValue *value, size_t index) { |
|
1130 if (index >= value->value.array.array_size) { |
|
1131 return NULL; |
|
1132 } |
|
1133 CxJsonValue *ret = value->value.array.array[index]; |
|
1134 // TODO: replace with a low level cx_array_remove() |
|
1135 size_t count = value->value.array.array_size - index - 1; |
|
1136 if (count > 0) { |
|
1137 memmove(value->value.array.array + index, value->value.array.array + index + 1, count * sizeof(CxJsonValue*)); |
|
1138 } |
|
1139 value->value.array.array_size--; |
|
1140 return ret; |
|
1141 } |
|
1142 |
1129 CxIterator cxJsonArrIter(const CxJsonValue *value) { |
1143 CxIterator cxJsonArrIter(const CxJsonValue *value) { |
1130 return cxIteratorPtr( |
1144 return cxIteratorPtr( |
1131 value->value.array.array, |
1145 value->value.array.array, |
1132 value->value.array.array_size |
1146 value->value.array.array_size |
1133 ); |
1147 ); |