|
|
1.1 ! root 1: #include "libc.h" ! 2: ! 3: static int goo; /* so no empty object on cray */ ! 4: ! 5: #ifndef CRAY ! 6: ! 7: #define A(x) ((((long)x)+sizeof(long)-1)&~(sizeof(long)-1)) ! 8: ! 9: char *next; ! 10: int nleft; ! 11: ! 12: char * ! 13: malloc(n) ! 14: { ! 15: extern char *sbrk(); ! 16: char *s; ! 17: ! 18: n = A(n); ! 19: if(n > nleft){ ! 20: next = sbrk(nleft = A(32000)); ! 21: if(next == (char *)-1){ ! 22: perror("mk: sbrk"); ! 23: Exit(); ! 24: } ! 25: } ! 26: s = next; ! 27: next += n; ! 28: nleft -= n; ! 29: return(s); ! 30: } ! 31: ! 32: free(s) ! 33: char *s; ! 34: { ! 35: } ! 36: ! 37: char * ! 38: realloc(s, n) ! 39: char *s; ! 40: unsigned n; ! 41: { ! 42: char *r; ! 43: ! 44: r = malloc(n); ! 45: memcpy(r, s, n); ! 46: return(r); ! 47: } ! 48: ! 49: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.