myMPD
Internal API documentation
Loading...
Searching...
No Matches
rax_extras.c File Reference

RAX helper functions. More...

#include "src/lib/rax_extras.h"
#include "src/lib/random.h"
#include "src/lib/sds/sds_extras.h"
#include <stdlib.h>
Include dependency graph for rax_extras.c:

Functions

sds rax_insert_no_dup (rax *r, sds key, void *data)
void rax_free_data (rax *r, rax_free_data_callback free_cb)
static void rax_free_sds_data_cb (void *data)
void rax_free_sds_data (rax *r)

Detailed Description

RAX helper functions.

Function Documentation

◆ rax_free_data()

void rax_free_data ( rax * r,
rax_free_data_callback free_cb )

Frees a rax tree and its data with a free_cb

Parameters
rrax tree to free
free_cbcallback to free data or NULL to free a pointer

◆ rax_free_sds_data()

void rax_free_sds_data ( rax * r)

Frees a rax tree and its sds data

Parameters
rrax tree to free

◆ rax_free_sds_data_cb()

void rax_free_sds_data_cb ( void * data)
static

Callback to free sds data

Parameters
datapointer to sds string

◆ rax_insert_no_dup()

sds rax_insert_no_dup ( rax * r,
sds key,
void * data )

Inserts the key into the radix tree. Appends random chars to the key until it is uniq.

Parameters
rrax tree to insert
keykey to insert
datadata to insert
Returns
the key that was inserted (may be different from the original key if it was a duplicate)