Annotation of researchv9/jerq/src/lib/j/balloc.c, revision 1.1

1.1     ! root        1: #include <jerq.h>
        !             2: /*
        !             3:  * All Bitmaps come from here
        !             4:  */
        !             5: Bitmap *
        !             6: realballoc(r, caller)
        !             7:        Rectangle  r;
        !             8:        char *caller;
        !             9: {
        !            10:        register rox=r.origin.x, roy=r.origin.y;
        !            11:        register rcx=r.corner.x, rcy=r.corner.y;
        !            12:        register left, right;
        !            13:        register Bitmap *bp;
        !            14:        char *realgcalloc(), *realalloc();
        !            15: 
        !            16:        if((bp=(Bitmap *)realalloc(sizeof(Bitmap), caller))==0)
        !            17:                return 0;
        !            18:        left=rox&~WORDMASK;
        !            19:        if((right=rcx)&WORDMASK){
        !            20:                right|=WORDMASK;
        !            21:                right++;
        !            22:        }
        !            23:        bp->width=(right-left)>>WORDSHIFT;
        !            24:        bp->rect.origin.x=rox; bp->rect.origin.y=roy;
        !            25:        bp->rect.corner.x=rcx; bp->rect.corner.y=rcy;
        !            26:        if(realgcalloc(((unsigned long)bp->width<<2)*(rcy-roy),
        !            27:           (long **)&bp->base, caller)==0){
        !            28:                free((char *) bp);
        !            29:                return 0;
        !            30:        }
        !            31:        bp->_null=0;
        !            32:        return bp;
        !            33: }
        !            34: 
        !            35: 
        !            36: Bitmap *
        !            37: balloc(r)
        !            38:        Rectangle r;
        !            39: {
        !            40:        return realballoc(r, (char *)0);
        !            41: }
        !            42: 
        !            43: bfree(bp)
        !            44:        register Bitmap *bp;
        !            45: {
        !            46:        if(bp){
        !            47:                gcfree((char *)bp->base);
        !            48:                free((char *)bp);
        !            49:        }
        !            50: }

unix.superglobalmegacorp.com

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