MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / doinsert

Function doinsert

regex/regcomp.c:1388–1429  ·  view source on GitHub ↗

- doinsert - insert a sop into the strip == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos); */

(p, op, opnd, pos)

Source from the content-addressed store, hash-verified

1386 == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
1387 */
1388static void
1389doinsert(p, op, opnd, pos)
1390register struct parse *p;
1391sop op;
1392size_t opnd;
1393sopno pos;
1394{
1395 register sopno sn;
1396 register sop s;
1397 register int i;
1398
1399 /* avoid making error situations worse */
1400 if (p->error != 0)
1401 return;
1402
1403 sn = HERE();
1404 EMIT(op, opnd); /* do checks, ensure space */
1405 assert(HERE() == sn+1);
1406 s = p->strip[sn];
1407
1408 /* adjust paren pointers */
1409 assert(pos > 0);
1410 for (i = 1; i < NPAREN; i++) {
1411 if (p->pbegin[i] >= pos) {
1412 p->pbegin[i]++;
1413 }
1414 if (p->pend[i] >= pos) {
1415 p->pend[i]++;
1416 }
1417 }
1418 {
1419 int length=(HERE()-pos-1)*sizeof(sop);
1420 bmove_upp((uchar *) &p->strip[pos+1]+length,
1421 (uchar *) &p->strip[pos]+length,
1422 length);
1423 }
1424#ifdef OLD_CODE
1425 memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos],
1426 (HERE()-pos-1)*sizeof(sop));
1427#endif
1428 p->strip[pos] = s;
1429}
1430
1431/*
1432 - dofwd - complete a forward reference

Callers

nothing calls this directly

Calls 1

bmove_uppFunction · 0.85

Tested by

no test coverage detected