Welcome to little lamb

Code » limb » release » tree

[release] / src / doc / cdb.h / cdb_init_frommem.3.md

% limb manual
% cdb_init_frommem(3)
% limb 0.1.0
% 2023-07-24

# NAME

cdb_init_frommem - initialize a cdb from memory area

# SYNOPSIS

    #include <limb/cdb.h>

```pre hl
void cdb_init_frommem(cdb *<em>c</em>, const char *<em>mem</em>, u32 <em>len</em>)
```

# DESCRIPTION

The `cdb_init_frommem`() function initializes the cdb pointed to by `c`, which
must be `CDB_ZERO` before the call, to use the memory pointed by `mem` which
must hold the content of a valid cdb file, for `len` bytes.

! WARNING:
! A cdb initialized via this function is just as valid as with one of the
! functions using a file as backend. However, you should *not* call
! [cdb_free](3) with a cdb initialized from `cdb_init_frommem`().
! Instead, it is up to the caller to free the memory pointed to by `mem`
! however it needs to, once the cdb isn't needed anymore.

# SEE ALSO

[cdb_init](3)