User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v7.5.x:api:ubf:bneeded.3

bneeded

Name

Bneeded — Allocated UBF buffer

Synopsis

#include <ubf.h>

long Bneeded(BFLDOCC nrfields, BFLDLEN totsize);

Link with -lubf -lnstd -lm -lpthread

DESCRIPTION

Estimate the buffer size which is needed for storing nrfields number of fields for which total size in bytes would be a totsize. Function basically adds to result the size of UBF header and adds alignment byte sizes. Estimation is done on CARRAY field bases, because it has a largest metadata area (i.e. length property).

RETURN VALUE

On success, Bneeded() returns estimated buffer size; on error, -1 is returned, with Berror set to indicate the error.

ERRORS

Note that Bstrerror() returns generic error message plus custom message with debug info from last function call.

BEINVAL The total size of bigger than MAXUBFLEN, nrfields is less or equal to zero, totsize is less or equal to zero.

EXAMPLE

See ubftest/test_mem.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd