1: # include <ingres.h> 2: # include <access.h> 3: # include <sccs.h> 4: 5: SCCSID(@(#)newlino.c 8.1 12/31/84) 6: 7: /* 8: ** newlino finds a free line number which it returns and adjusts 9: ** the next line counter (Nxtlino) by the length of the tuple (len). 10: ** This routine is used to recover unused sections of the 11: ** line number table (Acc_head->linetab). 12: */ 13: 14: newlino(len) 15: int len; 16: { 17: register int newlno, nextlno; 18: register short *lp; 19: 20: nextlno = Acc_head->nxtlino; 21: lp = &Acc_head->linetab[0]; 22: for (newlno = 0; newlno < nextlno; newlno++) 23: { 24: if (*lp == 0) 25: { 26: /* found a free line number */ 27: *lp = Acc_head->linetab[-nextlno]; 28: Acc_head->linetab[-nextlno] += len; 29: return (newlno); 30: } 31: lp--; 32: } 33: 34: /* no free line numbers. use nxtlino */ 35: Acc_head->linetab[-(nextlno + 1)] = *lp + len; 36: Acc_head->nxtlino++; 37: return (nextlno); 38: }