]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/port/ucallocb.c
kernel: replace ulong with uintptr in ucallocb() and fix unneeded parentheses
[plan9front.git] / sys / src / 9 / port / ucallocb.c
index 93a07d336b05ea4c46080f7e30eb6d4b7b141f70..126733d9a341c782331da36c1da8f30d5ad3c255 100644 (file)
@@ -24,25 +24,25 @@ static Block*
 _ucallocb(int size)
 {
        Block *b;
-       ulong addr;
+       uintptr addr;
 
        if((b = ucalloc(sizeof(Block)+size+Hdrspc)) == nil)
                return nil;
 
        b->next = nil;
        b->list = nil;
-       b->free = 0;
+       b->free = nil;
        b->flag = 0;
 
        /* align start of data portion by rounding up */
-       addr = (ulong)b;
+       addr = (uintptr)b;
        addr = ROUND(addr + sizeof(Block), BLOCKALIGN);
        b->base = (uchar*)addr;
 
        /* align end of data portion by rounding down */
-       b->lim = ((uchar*)b) + msize(b);
-       addr = (ulong)(b->lim);
-       addr = addr & ~(BLOCKALIGN-1);
+       b->lim = (uchar*)b + msize(b);
+       addr = (uintptr)b->lim;
+       addr &= ~(BLOCKALIGN-1);
        b->lim = (uchar*)addr;
 
        /* leave sluff at beginning for added headers */
@@ -123,7 +123,7 @@ ucfreeb(Block *b)
         * drivers which perform non cache coherent DMA manage their own buffer
         * pool of uncached buffers and provide their own free routine.
         */
-       if(b->free) {
+       if(b->free != nil) {
                b->free(b);
                return;
        }