mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
more list macro conversion (issue #6361, plus documentation for new macro)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10067 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -29,6 +29,8 @@ extern "C" {
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "asterisk/linkedlists.h"
|
||||
|
||||
void ast_cli(int fd, char *fmt, ...)
|
||||
__attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
@@ -67,10 +69,10 @@ struct ast_cli_entry {
|
||||
until a NULL is returned.
|
||||
*/
|
||||
char *(*generator)(const char *line, const char *word, int pos, int n);
|
||||
/*! For linking */
|
||||
struct ast_cli_entry *next;
|
||||
/*! For keeping track of usage */
|
||||
int inuse;
|
||||
/*! For linking */
|
||||
AST_LIST_ENTRY(ast_cli_entry) list;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Asterisk -- An open source telephony toolkit.
|
||||
*
|
||||
* Copyright (C) 1999 - 2005, Digium, Inc.
|
||||
* Copyright (C) 1999 - 2006, Digium, Inc.
|
||||
*
|
||||
* Mark Spencer <markster@digium.com>
|
||||
* Kevin P. Fleming <kpfleming@digium.com>
|
||||
@@ -313,6 +313,26 @@ struct { \
|
||||
if (!__list_next) \
|
||||
(head)->last = __list_prev;
|
||||
|
||||
/*!
|
||||
\brief Inserts a list entry before the current entry during a traversal.
|
||||
\param head This is a pointer to the list head structure
|
||||
\param elm This is a pointer to the entry to be inserted.
|
||||
\param field This is the name of the field (declared using AST_LIST_ENTRY())
|
||||
used to link entries of this list together.
|
||||
|
||||
\note This macro can \b only be used inside an AST_LIST_TRAVERSE_SAFE_BEGIN()
|
||||
block.
|
||||
*/
|
||||
#define AST_LIST_INSERT_BEFORE_CURRENT(head, elm, field) do { \
|
||||
if (__list_prev) { \
|
||||
(elm)->field.next = __list_prev->field.next; \
|
||||
__list_prev->field.next = elm; \
|
||||
} else { \
|
||||
(elm)->field.next = (head)->first; \
|
||||
(head)->first = (elm); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*!
|
||||
\brief Closes a safe loop traversal block.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user