Annotation of 41BSD/lib/libpc/NEWZ.c, revision 1.1

1.1     ! root        1: /* Copyright (c) 1979 Regents of the University of California */
        !             2: 
        !             3: static char sccsid[] = "@(#)NEWZ.c 1.1 10/29/80";
        !             4: 
        !             5: #include "h00vars.h"
        !             6: #include "h01errs.h"
        !             7: 
        !             8: NEWZ(var, size)
        !             9:        char    **var;  /* pointer to item being deallocated */
        !            10:        int     size;   /* sizeof struct pointed to by var */
        !            11: {
        !            12:        register char   *cp;
        !            13:        char            *limit;
        !            14:        extern char     *malloc();
        !            15: 
        !            16:        cp = malloc(size);
        !            17:        if (cp == 0) {
        !            18:                ERROR(EOUTOFMEM,0);
        !            19:                return;
        !            20:        }
        !            21:        *var = cp;
        !            22:        if (cp < _minptr)
        !            23:                _minptr = cp;
        !            24:        limit = cp + size;
        !            25:        if (limit > _maxptr)
        !            26:                _maxptr = limit;
        !            27:        for (; cp < limit; *cp++ = '\0')
        !            28:                /* void */;
        !            29: }

unix.superglobalmegacorp.com

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