mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-13 13:28:34 +00:00
Add a linkedlist macro that maintains a sorted list
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@111036 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
9
CHANGES
9
CHANGES
@@ -31,6 +31,12 @@ SIP Changes
|
|||||||
* The ATTENDED_TRANSFER_COMPLETE_SOUND can now be set using setvar to cause a given
|
* The ATTENDED_TRANSFER_COMPLETE_SOUND can now be set using setvar to cause a given
|
||||||
audio file to be played upon completion of an attended transfer.
|
audio file to be played upon completion of an attended transfer.
|
||||||
|
|
||||||
|
CLI Changes
|
||||||
|
-----------
|
||||||
|
* New CLI command, "config reload <file.conf>" which reloads any module that
|
||||||
|
references that particular configuration file. Also added "config list"
|
||||||
|
which shows which configuration files are in use.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
--- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0 -------------
|
--- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0 -------------
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
@@ -135,9 +141,6 @@ CLI Changes
|
|||||||
* Added a CLI command, "devstate change", which allows you to set custom device
|
* Added a CLI command, "devstate change", which allows you to set custom device
|
||||||
states from the func_devstate module that provides the DEVICE_STATE() function
|
states from the func_devstate module that provides the DEVICE_STATE() function
|
||||||
and handling of the "Custom:" devices.
|
and handling of the "Custom:" devices.
|
||||||
* New CLI command, "config reload <file.conf>" which reloads any module that
|
|
||||||
references that particular configuration file. Also added "config list"
|
|
||||||
which shows which configuration files are in use.
|
|
||||||
|
|
||||||
SIP changes
|
SIP changes
|
||||||
-----------
|
-----------
|
||||||
|
|||||||
@@ -456,6 +456,7 @@ struct { \
|
|||||||
\li AST_LIST_INSERT_AFTER()
|
\li AST_LIST_INSERT_AFTER()
|
||||||
\li AST_LIST_INSERT_HEAD()
|
\li AST_LIST_INSERT_HEAD()
|
||||||
\li AST_LIST_INSERT_TAIL()
|
\li AST_LIST_INSERT_TAIL()
|
||||||
|
\li AST_LIST_INSERT_SORTALPHA()
|
||||||
*/
|
*/
|
||||||
#define AST_LIST_TRAVERSE(head,var,field) \
|
#define AST_LIST_TRAVERSE(head,var,field) \
|
||||||
for((var) = (head)->first; (var); (var) = (var)->field.next)
|
for((var) = (head)->first; (var); (var) = (var)->field.next)
|
||||||
@@ -694,6 +695,38 @@ struct { \
|
|||||||
|
|
||||||
#define AST_RWLIST_INSERT_TAIL AST_LIST_INSERT_TAIL
|
#define AST_RWLIST_INSERT_TAIL AST_LIST_INSERT_TAIL
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Inserts a list entry into a alphabetically sorted list
|
||||||
|
* \param head Pointer to the list head structure
|
||||||
|
* \param elm Pointer to the entry to be inserted
|
||||||
|
* \param field Name of the list entry field (declared using AST_LIST_ENTRY())
|
||||||
|
* \param sortfield Name of the field on which the list is sorted
|
||||||
|
*/
|
||||||
|
#define AST_LIST_INSERT_SORTALPHA(head, elm, field, sortfield) do { \
|
||||||
|
if (!(head)->first) { \
|
||||||
|
(head)->first = (elm); \
|
||||||
|
(head)->last = (elm); \
|
||||||
|
} else { \
|
||||||
|
typeof((head)->first) cur = (head)->first, prev = NULL; \
|
||||||
|
while (cur && strcmp(cur->sortfield, elm->sortfield) < 0) { \
|
||||||
|
prev = cur; \
|
||||||
|
cur = cur->field.next; \
|
||||||
|
} \
|
||||||
|
if (!prev) { /* Same as INSERT_HEAD */ \
|
||||||
|
(elm)->field.next = (head)->first; \
|
||||||
|
(head)->first = (elm); \
|
||||||
|
} else if (!cur) { /* Same as INSERT_TAIL */ \
|
||||||
|
(head)->last->field.next = (elm); \
|
||||||
|
(head)->last = (elm); \
|
||||||
|
} else { \
|
||||||
|
(elm)->field.next = cur; \
|
||||||
|
(prev)->field.next = (elm); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define AST_RWLIST_INSERT_SORTALPHA AST_LIST_INSERT_SORTALPHA
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Appends a whole list to the tail of a list.
|
\brief Appends a whole list to the tail of a list.
|
||||||
\param head This is a pointer to the list head structure
|
\param head This is a pointer to the list head structure
|
||||||
|
|||||||
@@ -878,7 +878,7 @@ static void config_cache_attribute(const char *configfile, enum config_cache_att
|
|||||||
cfmtime->who_asked = cfmtime->filename + strlen(configfile) + 1;
|
cfmtime->who_asked = cfmtime->filename + strlen(configfile) + 1;
|
||||||
strcpy(cfmtime->who_asked, who_asked);
|
strcpy(cfmtime->who_asked, who_asked);
|
||||||
/* Note that the file mtime is initialized to 0, i.e. 1970 */
|
/* Note that the file mtime is initialized to 0, i.e. 1970 */
|
||||||
AST_LIST_INSERT_TAIL(&cfmtime_head, cfmtime, list);
|
AST_LIST_INSERT_SORTALPHA(&cfmtime_head, cfmtime, list, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stat(configfile, &statbuf))
|
if (!stat(configfile, &statbuf))
|
||||||
@@ -1211,7 +1211,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
|||||||
cfmtime->who_asked = cfmtime->filename + strlen(fn) + 1;
|
cfmtime->who_asked = cfmtime->filename + strlen(fn) + 1;
|
||||||
strcpy(cfmtime->who_asked, who_asked);
|
strcpy(cfmtime->who_asked, who_asked);
|
||||||
/* Note that the file mtime is initialized to 0, i.e. 1970 */
|
/* Note that the file mtime is initialized to 0, i.e. 1970 */
|
||||||
AST_LIST_INSERT_TAIL(&cfmtime_head, cfmtime, list);
|
AST_LIST_INSERT_SORTALPHA(&cfmtime_head, cfmtime, list, filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user