Define the initial values separate from the STATIC definitions

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10255 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2006-02-15 23:00:07 +00:00
parent a0d438fb6c
commit 6f8cdb5c03
2 changed files with 21 additions and 11 deletions

View File

@@ -3355,8 +3355,8 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
char callerid[512]; char callerid[512];
char ext_context[256]=""; char ext_context[256]="";
int res = 0, cmd = 0; int res = 0, cmd = 0;
struct ast_vm_user *receiver, *vmtmp; struct ast_vm_user *receiver = NULL, *vmtmp;
AST_LIST_HEAD_NOLOCK(extension, ast_vm_user) extensions; AST_LIST_HEAD_NOLOCK_STATIC(extensions, ast_vm_user);
char tmp[256]; char tmp[256];
char *stringp, *s; char *stringp, *s;
int saved_messages = 0, found = 0; int saved_messages = 0, found = 0;

View File

@@ -100,6 +100,23 @@ struct name { \
struct type *last; \ struct type *last; \
} }
/*!
\brief Defines initial values for a declaration of AST_LIST_HEAD
*/
#define AST_LIST_HEAD_INIT_VALUE { \
.first = NULL, \
.last = NULL, \
.lock = AST_MUTEX_INIT_VALUE, \
}
/*!
\brief Defines initial values for a declaration of AST_LIST_HEAD_NOLOCK
*/
#define AST_LIST_HEAD_NOLOCK_INIT_VALUE { \
.first = NULL, \
.last = NULL, \
}
/*! /*!
\brief Defines a structure to be used to hold a list of specified type, statically initialized. \brief Defines a structure to be used to hold a list of specified type, statically initialized.
\param name This will be the name of the defined structure. \param name This will be the name of the defined structure.
@@ -122,11 +139,7 @@ struct name { \
struct type *first; \ struct type *first; \
struct type *last; \ struct type *last; \
ast_mutex_t lock; \ ast_mutex_t lock; \
} name = { \ } name = AST_LIST_HEAD_INIT_VALUE;
.first = NULL, \
.last = NULL, \
.lock = AST_MUTEX_INIT_VALUE, \
};
/*! /*!
\brief Defines a structure to be used to hold a list of specified type, statically initialized. \brief Defines a structure to be used to hold a list of specified type, statically initialized.
@@ -137,10 +150,7 @@ struct name { \
struct name { \ struct name { \
struct type *first; \ struct type *first; \
struct type *last; \ struct type *last; \
} name = { \ } name = AST_LIST_HEAD_NOLOCK_INIT_VALUE;
.first = NULL, \
.last = NULL, \
};
/*! /*!
\brief Initializes a list head structure with a specified first entry. \brief Initializes a list head structure with a specified first entry.