Convert a list of values to a list of string values. The conversion of each item in list is done using toStringOrNull */
| 173 | /* Convert a list of values to a list of string values. |
| 174 | The conversion of each item in list is done using toStringOrNull */ |
| 175 | SIValue AR_TOSTRINGLIST(SIValue *argv, int argc, void *private_data) { |
| 176 | ASSERT(argc == 1); |
| 177 | if(SI_TYPE(argv[0]) == T_NULL) { |
| 178 | return SI_NullVal(); |
| 179 | } |
| 180 | ASSERT(SI_TYPE(argv[0]) == T_ARRAY); |
| 181 | SIValue originalArray = argv[0]; |
| 182 | |
| 183 | // get array length |
| 184 | uint32_t arrayLen = SIArray_Length(originalArray); |
| 185 | |
| 186 | SIValue array = SI_Array(arrayLen); |
| 187 | for(uint i = 0; i < arrayLen; i++) { |
| 188 | SIValue v = SIArray_Get(originalArray, i); |
| 189 | SIValue vstr = AR_TOSTRING(&v, 1, NULL); |
| 190 | SIArray_Append(&array, vstr); |
| 191 | SIValue_Free(vstr); |
| 192 | SIValue_Free(v); |
| 193 | } |
| 194 | return array; |
| 195 | } |
| 196 | |
| 197 | // normalize index |
| 198 | // returns true if 'index' is in range: [0..array_len] |
nothing calls this directly
no test coverage detected