Atrinik Server  4.0
Macros
Shared string macros

Macros

#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.

Macro Definition Documentation

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

Add reference to a non-null hash.

Parameters
<em>nv</em>Pointer to shared string.

Definition at line 153 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
<em>sv</em>Pointer to shared string.
<em>nv</em>String to add reference to. Must be a shared string.

Definition at line 116 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
<em>nv</em>Shared string to free and NULL.

Definition at line 130 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
<em>sv</em>Pointer to shared string.
<em>nv</em>String to add reference to. Must be a shared string.
Warning
Like FREE_AND_CLEAR_HASH(), but without { and }.

Definition at line 162 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
<em>sv</em>Shared string.
<em>nv</em>String to copy to the shared string.

Definition at line 100 of file global.h.

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

Free a shared string.

Parameters
<em>nv</em>Shared string to free.

Definition at line 143 of file global.h.