Skip to content
ArenaAllocatorDeinit

ArenaAllocatorDeinit

Description

Release every chunk currently owned by self. Walks the chunk list and returns each one to the kernel, then zeroes the struct so any post-deinit dispatch trips ValidateAllocator on the cleared __magic.

Parameters

Name Direction Description
self in,out ArenaAllocator instance, or NULL.

Success

Function returns. Every previously-handed-out pointer is invalid; the arena is back to its post-Init zero state and cannot be used until re-initialised.

Failure

No action when self is NULL.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    void ArenaAllocatorDeinit(ArenaAllocator *self) {
        if (!self) {
            return;
        if (!DnsBuildQuery(&query, id, hostname, qtype)) {
            VecDeinit(&query);
            ArenaAllocatorDeinit(&scratch);
            return false;
        }
        VecDeinit(&query);
        if (got <= 0) {
            ArenaAllocatorDeinit(&scratch);
            return false;
        }
        if (!ok || resp.id != id || resp.rcode != DNS_RCODE_NOERROR) {
            DnsResponseDeinit(&resp);
            ArenaAllocatorDeinit(&scratch);
            return false;
        }
        }
        DnsResponseDeinit(&resp);
        ArenaAllocatorDeinit(&scratch);
        return found;
    }
        }
    
        ArenaAllocatorDeinit(&arena);
        return ok;
    }
        }
    
        ArenaAllocatorDeinit(&arena);
        return ok;
    }
        ok = ok && VecLen(&v) == 4096 && VecAt(&v, 0) == 0 && VecAt(&v, 4095) == 4095;
        VecDeinit(&v);
        ArenaAllocatorDeinit(&arena);
        return ok;
    }
        ok    = ok && (c != NULL) && (c == a); // Reset reuses the first chunk.
    
        ArenaAllocatorDeinit(&arena);
        return ok;
    }
        }
    
        ArenaAllocatorDeinit(&arena);
        return ok;
    }
Last updated on