MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / pack_vector

Function pack_vector

extern/btyacc/output.c:528–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526
527
528int pack_vector(int vector)
529{
530 register int i, j, k, l;
531 register int t;
532 register int loc;
533 register int ok;
534 register Yshort *from;
535 register Yshort *to;
536 int newmax;
537
538 i = order[vector];
539 t = tally[i];
540 assert(t);
541
542 from = froms[i];
543 to = tos[i];
544
545 j = lowzero - from[0];
546 for (k = 1; k < t; ++k)
547 if (lowzero - from[k] > j)
548 j = lowzero - from[k];
549 for (;; ++j)
550 {
551 if (j == 0)
552 continue;
553 ok = 1;
554 for (k = 0; ok && k < t; k++)
555 {
556 loc = j + from[k];
557 if (loc >= maxtable)
558 {
559 if (loc >= MAXTABLE)
560 fatal("maximum table size exceeded");
561
562 newmax = maxtable;
563 do { newmax += 200; } while (newmax <= loc);
564 table = (Yshort *) REALLOC(table, newmax*sizeof(Yshort));
565 if (table == 0) no_space();
566 check = (Yshort *) REALLOC(check, newmax*sizeof(Yshort));
567 if (check == 0) no_space();
568 for (l = maxtable; l < newmax; ++l)
569 {
570 table[l] = 0;
571 check[l] = -1;
572 }
573 maxtable = newmax;
574 }
575
576 if (check[loc] != -1)
577 ok = 0;
578 }
579 for (k = 0; ok && k < vector; k++)
580 {
581 if (pos[k] == j)
582 ok = 0;
583 }
584 if (ok)
585 {

Callers 1

pack_tableFunction · 0.85

Calls 3

assertClass · 0.85
fatalFunction · 0.85
no_spaceFunction · 0.85

Tested by

no test coverage detected