MCPcopy Create free account
hub / github.com/MariaDB/server / InitArray

Method InitArray

storage/connect/json.cpp:1281–1304  ·  view source on GitHub ↗

/ Make the array of values from the values list. */ /

Source from the content-addressed store, hash-verified

1279/* Make the array of values from the values list. */
1280/***********************************************************************/
1281void JARRAY::InitArray(PGLOBAL g)
1282{
1283 int i;
1284 PJVAL jvp, *pjvp = &First;
1285
1286 for (Size = 0, jvp = First; jvp; jvp = jvp->Next)
1287 if (!jvp->Del)
1288 Size++;
1289
1290 if (Size > Alloc) {
1291 // No need to realloc after deleting values
1292 Mvals = (PJVAL*)PlugSubAlloc(g, NULL, Size * sizeof(PJVAL));
1293 Alloc = Size;
1294 } // endif Size
1295
1296 for (i = 0, jvp = First; jvp; jvp = jvp->Next)
1297 if (!jvp->Del) {
1298 Mvals[i++] = jvp;
1299 pjvp = &jvp->Next;
1300 Last = jvp;
1301 } else
1302 *pjvp = jvp->Next;
1303
1304} // end of InitArray
1305
1306/***********************************************************************/
1307/* Get the Nth value of an Array. */

Callers 15

ParseArrayMethod · 0.80
GetKeyListMethod · 0.80
GetValListMethod · 0.80
MakeTopTreeMethod · 0.80
MakeJsonMethod · 0.80
GetRowMethod · 0.80
WriteColumnMethod · 0.80
MakeDocumentMethod · 0.80
CloseDBMethod · 0.80
MakeJsonMethod · 0.80
GetRowMethod · 0.80
WriteValueMethod · 0.80

Calls 1

PlugSubAllocFunction · 0.85

Tested by

no test coverage detected