SS8_INIT(3)                      Ssstr Manual                      SS8_INIT(3)



NAME
       ss8_init, ss8_destroy - initialize and destroy ssstr byte strings

SYNOPSIS
       #include <ss8str.h>

       ss8str *ss8_init(ss8str *str);
       void    ss8_destroy(ss8str *str);

       static ss8str s = SS8_STATIC_INITIALIZER;

DESCRIPTION
       ss8_init()  initializes  the ss8str object that str points to.  The ob‐
       ject becomes valid and its value is set to the empty string.  No memory
       allocation is performed.  Behavior is undefined unless str points to an
       invalid (that is, uninitialized or previously destroyed) ss8str object.

       For global or static variables, SS8_STATIC_INITIALIZER can be used as a
       static initialization value instead of calling ss8_init().  Note that a
       zero-initialized ss8str object is not valid.

       All valid ss8str objects must be destroyed by calling ss8_destroy() af‐
       ter last use; otherwise dynamically allocated memory may be leaked.

       ss8_destroy() destroys the ss8str object that str points to, deallocat‐
       ing any associated dynamic storage.  Behavior is undefined  unless  str
       points to a valid ss8str object.

       A  destroyed ss8str object is invalid and must be re-initialized before
       reuse.

RETURN VALUE
       ss8_init() returns str.

NOTES
       SS8_STATIC_INITIALIZER works also for initializing local or dynamically
       allocated variables.  However, it can result in less efficient code be‐
       ing generated when compared to calling ss8_init().

SEE ALSO
       ss8_clear(3), ss8_init_copy(3), ssstr(7)



SSSTR                             2023-12-30                       SS8_INIT(3)