structs_type_string
,
structs_type_string_null
, —
structs types for strings
PDEL Library (libpdel, -lpdel)
The
STRUCTS_STRING_TYPE
()
and STRUCTS_FIXEDSTRING_TYPE
() macros define a
structs(3)
type (i.e., a struct structs_type
) for describing
variable and bounded length strings, respectively.
STRUCTS_STRING_TYPE
()
describes a char *
data type which points to a
string buffer allocated with
typed_mem(3)
type mtype. If asnull is
non-zero, then an empty string may be represented as a
NULL
pointer; otherwise, the char
*
pointer can never be NULL
(or else the
program may core dump) and so the empty string must always be represented as
a pointer to a zero length string.
STRUCTS_FIXEDSTRING_TYPE
()
describes an array of char
having length
bufsize in which a string having length at most
bufsize - 1 is stored. The string is always terminated
with a '\0' byte.
The
structs(3)
library supplies two pre-defined variable length string types,
structs_type_string
and
structs_type_string_null
. Both types use the
typed_mem(3)
type STRUCTS_TYPE_STRING_MTYPE
, defined in the
header file. structs_type_string
represents empty
strings as pointers to an empty string, while
structs_type_string_null
represents empty strings as
NULL
pointers.
The PDEL library was developed at Packet Design, LLC.
http://www.packetdesign.com/
Archie Cobbs
⟨archie@freebsd.org⟩