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

Function infix

contrib/intarray/_int_bool.c:563–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561}
562
563static void
564infix(INFIX *in, bool first)
565{
566 /* since this function recurses, it could be driven to stack overflow. */
567 check_stack_depth();
568
569 if (in->curpol->type == VAL)
570 {
571 RESIZEBUF(in, 11);
572 sprintf(in->cur, "%d", in->curpol->val);
573 in->cur = strchr(in->cur, '\0');
574 in->curpol--;
575 }
576 else if (in->curpol->val == (int32) '!')
577 {
578 bool isopr = false;
579
580 RESIZEBUF(in, 1);
581 *(in->cur) = '!';
582 in->cur++;
583 *(in->cur) = '\0';
584 in->curpol--;
585 if (in->curpol->type == OPR)
586 {
587 isopr = true;
588 RESIZEBUF(in, 2);
589 sprintf(in->cur, "( ");
590 in->cur = strchr(in->cur, '\0');
591 }
592 infix(in, isopr);
593 if (isopr)
594 {
595 RESIZEBUF(in, 2);
596 sprintf(in->cur, " )");
597 in->cur = strchr(in->cur, '\0');
598 }
599 }
600 else
601 {
602 int32 op = in->curpol->val;
603 INFIX nrm;
604
605 in->curpol--;
606 if (op == (int32) '|' && !first)
607 {
608 RESIZEBUF(in, 2);
609 sprintf(in->cur, "( ");
610 in->cur = strchr(in->cur, '\0');
611 }
612
613 nrm.curpol = in->curpol;
614 nrm.buflen = 16;
615 nrm.cur = nrm.buf = (char *) palloc(sizeof(char) * nrm.buflen);
616
617 /* get right operand */
618 infix(&nrm, false);
619
620 /* get & print left operand */

Callers 1

bqarr_outFunction · 0.70

Calls 3

check_stack_depthFunction · 0.85
pallocFunction · 0.50
pfreeFunction · 0.50

Tested by

no test coverage detected