MCPcopy Create free account
hub / github.com/apache/cloudberry / lookupVariable

Function lookupVariable

src/bin/pgbench/pgbench.c:1434–1458  ·  view source on GitHub ↗

Locate a variable by name; returns NULL if unknown */

Source from the content-addressed store, hash-verified

1432
1433/* Locate a variable by name; returns NULL if unknown */
1434static Variable *
1435lookupVariable(CState *st, char *name)
1436{
1437 Variable key;
1438
1439 /* On some versions of Solaris, bsearch of zero items dumps core */
1440 if (st->nvariables <= 0)
1441 return NULL;
1442
1443 /* Sort if we have to */
1444 if (!st->vars_sorted)
1445 {
1446 qsort((void *) st->variables, st->nvariables, sizeof(Variable),
1447 compareVariableNames);
1448 st->vars_sorted = true;
1449 }
1450
1451 /* Now we can search */
1452 key.name = name;
1453 return (Variable *) bsearch((void *) &key,
1454 (void *) st->variables,
1455 st->nvariables,
1456 sizeof(Variable),
1457 compareVariableNames);
1458}
1459
1460/* Get the value of a variable, in string form; returns NULL if unknown */
1461static char *

Callers 4

getVariableFunction · 0.85
lookupCreateVariableFunction · 0.85
evaluateExprFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected