Skip to content
BudgetAllocatorDeinit

BudgetAllocatorDeinit

Description

Tear down a BudgetAllocator. No-op for the backing memory (the caller owns it); resets internal bookkeeping so subsequent dispatch calls will trip the magic check.

Parameters

Name Direction Description
self in,out BudgetAllocator instance.

Success

Function returns. Internal state is zeroed.

Failure

No action when self is NULL.

Usage example (Cross-references)

Usage examples (Cross-references)
    // [bitmap | pad | slots] -- matching the validator's invariant checks above.
    
    void BudgetAllocatorDeinit(BudgetAllocator *self) {
        if (!self)
            return;
        }
    
        BudgetAllocatorDeinit(&bp);
        return ok;
    }
        Allocator      *alloc    = ALLOCATOR_OF(&bp);
        void           *p        = AllocatorAlloc(alloc, 0, false);
        BudgetAllocatorDeinit(&bp);
        return p == NULL;
    }
        if (p)
            AllocatorFree(alloc, p);
        BudgetAllocatorDeinit(&bp);
        return ok;
    }
        ok             = ok && (overflow == NULL);
    
        BudgetAllocatorDeinit(&bp);
        return ok;
    }
    
        AllocatorFree(alloc, b);
        BudgetAllocatorDeinit(&bp);
        return ok;
    }
        if (c)
            AllocatorFree(alloc, c);
        BudgetAllocatorDeinit(&bp);
        return ok;
    }
        void           *big      = AllocatorAlloc(alloc, 4096, true);
        bool            ok       = (big == NULL);
        BudgetAllocatorDeinit(&bp);
        return ok;
    }
        if (p2)
            AllocatorFree(alloc, p2);
        BudgetAllocatorDeinit(&bp);
        return ok;
    }
        u8              buf[4] = {0};
        BudgetAllocator bp     = BudgetAllocatorInit(buf, sizeof(buf), sizeof(Node));
        BudgetAllocatorDeinit(&bp);
        return false;
    }
    
        StrDeinit(&s);
        BudgetAllocatorDeinit(&bp);
        return result;
    }
    
        StrDeinit(&s);
        BudgetAllocatorDeinit(&bp);
        return result;
    }
    
        StrDeinit(&s);
        BudgetAllocatorDeinit(&bp);
        return result;
    }
Last updated on