Libft
Custom implementation of core libc functions with additional utility helpers.
Loading...
Searching...
No Matches
detach.c File Reference
#include "libft.h"
#include "buckets.h"
Include dependency graph for detach.c:

Functions

void bucket_detach (void *bucket, void(*_)(void *))
 Detaches every pair from a single bucket chain without freeing them.
 
void buckets_detach (t_vector *buckets)
 Detaches every pair from the bucket chains without freeing them.
 

Function Documentation

◆ bucket_detach()

void bucket_detach ( void *  bucket,
void(*)(void *)  _ 
)

Detaches every pair from a single bucket chain without freeing them.

Sets each node's content to NULL. Shaped to be used as a buckets_foreach() callback; the destructor parameter is unused.

Parameters
bucketAddress of the bucket slot (a t_list *) to detach (borrowed).
_Unused destructor parameter (required by the callback signature).
Here is the caller graph for this function:

◆ buckets_detach()

void buckets_detach ( t_vector buckets)

Detaches every pair from the bucket chains without freeing them.

Sets each list node's content to NULL across all buckets, severing the link between the chains and their pairs. Used during a resize so the old chains can be freed while the pairs themselves are kept (they have been moved into the new bucket array).

Parameters
bucketsPointer to the bucket vector to detach (borrowed).
Here is the call graph for this function:
Here is the caller graph for this function: