0001 BNEEDED(3)
0002 ==========
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 Bneeded - Allocated UBF buffer
0009
0010
0011 SYNOPSIS
0012 --------
0013
0014 #include <ubf.h>
0015
0016 long Bneeded(BFLDOCC 'nrfields', BFLDLEN 'totsize');
0017
0018 Link with '-lubf -lnstd -lm -lpthread'
0019
0020 DESCRIPTION
0021 -----------
0022 Estimate the buffer size which is needed for storing 'nrfields' number of fields
0023 for which total size in bytes would be a 'totsize'. Function basically adds
0024 to result the size of UBF header and adds alignment byte sizes. Estimation is
0025 done on CARRAY field bases, because it has a largest metadata area (i.e. length
0026 property).
0027
0028
0029 RETURN VALUE
0030 ------------
0031 On success, *Bneeded()* returns estimated buffer size; on error, *-1* is
0032 returned, with *Berror* set to indicate the error.
0033
0034 ERRORS
0035 ------
0036 Note that *Bstrerror()* returns generic error message plus custom
0037 message with debug info from last function call.
0038
0039
0040 *BEINVAL* The total size of bigger than *MAXUBFLEN*, 'nrfields' is less or
0041 equal to zero, 'totsize' is less or equal to zero.
0042
0043 EXAMPLE
0044 -------
0045 See *ubftest/test_mem.c* for sample code.
0046
0047 BUGS
0048 ----
0049 Report bugs to support@mavimax.com
0050
0051 SEE ALSO
0052 --------
0053 *Balloc(3)* *Brealloc(3)* *Binit(3)*
0054
0055 COPYING
0056 -------
0057 (C) Mavimax, Ltd
0058