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

Function _readBitmapset

src/backend/nodes/readfuncs.c:224–260  ·  view source on GitHub ↗

* _readBitmapset */

Source from the content-addressed store, hash-verified

222 * _readBitmapset
223 */
224static Bitmapset *
225_readBitmapset(void)
226{
227 Bitmapset *result = NULL;
228
229 READ_TEMP_LOCALS();
230
231 token = pg_strtok(&length);
232 if (token == NULL)
233 elog(ERROR, "incomplete Bitmapset structure");
234 if (length != 1 || token[0] != '(')
235 elog(ERROR, "unrecognized token: \"%.*s\"", length, token);
236
237 token = pg_strtok(&length);
238 if (token == NULL)
239 elog(ERROR, "incomplete Bitmapset structure");
240 if (length != 1 || token[0] != 'b')
241 elog(ERROR, "unrecognized token: \"%.*s\"", length, token);
242
243 for (;;)
244 {
245 int val;
246 char *endptr;
247
248 token = pg_strtok(&length);
249 if (token == NULL)
250 elog(ERROR, "unterminated Bitmapset structure");
251 if (length == 1 && token[0] == ')')
252 break;
253 val = (int) strtol(token, &endptr, 10);
254 if (endptr != token + length)
255 elog(ERROR, "unrecognized integer: \"%.*s\"", length, token);
256 result = bms_add_member(result, val);
257 }
258
259 return result;
260}
261
262/*
263 * for use by extensions which define extensible nodes

Callers 2

readfuncs.cFile · 0.70
readBitmapsetFunction · 0.70

Calls 2

pg_strtokFunction · 0.85
bms_add_memberFunction · 0.85

Tested by

no test coverage detected