Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / samisc.h / sa_patrim_put.3.md

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

# NAME

sa_patrim_put - encode data in PATRIM format into an stralloc

# SYNOPSIS

    #include <limb/samisc.h>

```pre hl
int sa_patrim_put(stralloc *<em>sa</em>, u64 <em>id</em>, u64 <em>u</em>, const char *<em>data</em>)
```

# DESCRIPTION

The `sa_patrim_put`() function will encode into the given stralloc `sa` the
specified `id` in [patrim](5) format.

If it represents an (unsigned) integer, `u` must be its value, and `data` is
ignored.

If it represents a blob/byte array, `u` must be its size, and `data` point to
said data (of length `u`).

# RETURN VALUE

The `sa_patrim_put`() function returns 1 on success and 0 on failure, i.e.
failure to allocate memory within the given `sa`.