Atrinik Server 2.5
Defines
Shared string macros

Defines

#define FREE_AND_COPY_HASH(_sv_, _nv_)
#define FREE_AND_ADD_REF_HASH(_sv_, _nv_)
#define FREE_AND_CLEAR_HASH(_nv_)
#define FREE_ONLY_HASH(_nv_)
#define ADD_REF_NOT_NULL_HASH(_nv_)
#define FREE_AND_CLEAR_HASH2(_nv_)

Detailed Description

Common macros used for manipulating shared strings.


Define Documentation

#define ADD_REF_NOT_NULL_HASH (   _nv_)
Value:
if (_nv_)                           \
{                                   \
    add_refcount(_nv_);             \
}

Add reference to a non-null hash.

Parameters:
_nv_Pointer to shared string.

Definition at line 269 of file global.h.

#define FREE_AND_ADD_REF_HASH (   _sv_,
  _nv_ 
)
Value:
{                                         \
    if (_sv_)                             \
    {                                     \
        free_string_shared(_sv_);         \
    }                                     \
                                          \
    _sv_ = add_refcount(_nv_);            \
}

Free old hash and add a reference to the new one.

Parameters:
_sv_Pointer to shared string.
_nv_String to add reference to. Must be a shared string.

Definition at line 238 of file global.h.

#define FREE_AND_CLEAR_HASH (   _nv_)
Value:
{                                 \
    if (_nv_)                     \
    {                             \
        free_string_shared(_nv_); \
        _nv_ = NULL;              \
    }                             \
}

Free and NULL a shared string.

Parameters:
_nv_Shared string to free and NULL.

Definition at line 250 of file global.h.

#define FREE_AND_CLEAR_HASH2 (   _nv_)
Value:
if (_nv_)                          \
{                                  \
    free_string_shared(_nv_);      \
    _nv_ = NULL;                   \
}

Free old hash and add a reference to the new one.

Parameters:
_sv_Pointer to shared string.
_nv_String to add reference to. Must be a shared string.
Warning:
Like FREE_AND_CLEAR_HASH(), but without { and }.

Definition at line 277 of file global.h.

#define FREE_AND_COPY_HASH (   _sv_,
  _nv_ 
)
Value:
{                                      \
    if (_sv_)                          \
    {                                  \
        free_string_shared(_sv_);      \
    }                                  \
                                       \
    _sv_ = add_string(_nv_);           \
}

Free old shared string and add new string.

Parameters:
_sv_Shared string.
_nv_String to copy to the shared string.

Definition at line 225 of file global.h.

#define FREE_ONLY_HASH (   _nv_)
Value:
if (_nv_)                     \
{                             \
    free_string_shared(_nv_); \
}

Free a shared string.

Parameters:
_nv_Shared string to free.

Definition at line 261 of file global.h.