Annotation of researchv10no/cmd/tsort/refstore.c, revision 1.1.1.1

1.1       root        1: /* On machines that address memory in segments, reffetch and refstore
                      2:  * can be rewritten to save and store data in a different segment than
                      3:  * the rest of the program uses.
                      4:  */
                      5: 
                      6: #define XINC 8000
                      7: #include "ts.h"
                      8: 
                      9: static unsigned XMAX = 0;
                     10: static struct refc *x = 0;
                     11: char *malloc(), *realloc();
                     12: 
                     13: reffetch(i, rc)
                     14: unsigned i;
                     15: struct refc *rc;
                     16: {
                     17:        struct refc *xi;
                     18: 
                     19:        if (i >= XMAX) scream("i too big in reffetch\n");
                     20:        xi = x + i;
                     21:        rc->rcnext = xi->rcnext;
                     22:        rc->rcref = xi->rcref;
                     23:        }
                     24: 
                     25: refstore(i, rc)
                     26: unsigned i;
                     27: struct refc *rc;
                     28: {
                     29:        struct refc *xi;
                     30: 
                     31:        if (i >= XMAX) {
                     32:                XMAX += XINC;
                     33:                if (!x) x = (struct refc *) malloc(XINC*sizeof(struct refc));
                     34:                else x = (struct refc *) realloc(x, XMAX*sizeof(struct refc));
                     35:                if (!x) scream("not enough memory for refstore!");
                     36:                }
                     37:        if (i >= XMAX) scream("i too big in refstore\n");
                     38:        xi = x + i;
                     39:        xi->rcnext = rc->rcnext;
                     40:        xi->rcref = rc->rcref;
                     41:        }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.