summaryrefslogtreecommitdiff
path: root/include/asterisk/linkedlists.h
AgeCommit message (Collapse)Author
2018-01-27headers: Consistent use of typeof and/or __typeof__.Alexander Traud
Because of a copy-and-paste error, the Asterisk project was using __typeof instead of typeof. It works because typeof, __typeof, and __typeof__ are supported by GCC, but here the escaped variant was not intended. Therefore, for consistence, we change this to typeof. Change-Id: I2a962c3e596e882f691a19345445b14571a5f07c
2012-11-27Made AST_LIST_REMOVE() simpler and use better names.Richard Mudgett
* Update doxygen of AST_LIST_REMOVE(). ........ Merged revisions 376627 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 376628 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 376629 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376630 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-08Add some underscores in a few of our llist macros to reduce name collisions.Sean Bright
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358646 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-29Whitespace and some better macro variable names.Richard Mudgett
* Renamed AST_LIST_TRAVERSE_SAFE_BEGIN __new_prev to __list_current. * Renamed AST_LIST_MOVE_CURRENT __list_cur to __extracted. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@342664 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-10-29Fix AST_LIST_INSERT_BEFORE_CURRENT() updating the wrong variable.Richard Mudgett
AST_LIST_INSERT_BEFORE_CURRENT() could not be used twice in an iteration or before AST_LIST_REMOVE_CURRENT() without corrupting the list. AST_LIST_INSERT_BEFORE_CURRENT() could also corrupt the list if AST_LIST_INSERT_BEFORE_CURRENT() or AST_LIST_REMOVE_CURRENT() is used on the next iteration. * Fixed cut and paste error using the wrong variable in AST_LIST_INSERT_BEFORE_CURRENT(). * Added linked list unit tests for AST_LIST_INSERT_BEFORE_CURRENT(), AST_LIST_APPEND_LIST(), and AST_LIST_INSERT_LIST_AFTER(). ........ Merged revisions 342661 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 342662 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@342663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-19Merged revisions 328717 via svnmerge from Terry Wilson
https://origsvn.digium.com/svn/asterisk/branches/1.10 ................ r328717 | twilson | 2011-07-18 20:55:32 -0500 (Mon, 18 Jul 2011) | 14 lines Merged revisions 328716 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r328716 | twilson | 2011-07-18 20:35:53 -0500 (Mon, 18 Jul 2011) | 7 lines Make AST_LIST_REMOVE safer AST_LIST_REMOVE shouldn't modify the element passed in if it isn't found. This commit also adds linked list unit tests. Review: https://reviewboard.asterisk.org/r/1321/ ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328718 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-03Merged revisions 316265 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r316265 | russell | 2011-05-03 14:55:49 -0500 (Tue, 03 May 2011) | 5 lines Fix a bunch of compiler warnings generated by gcc 4.6.0. Most of these are -Wunused-but-set-variable, but there were a few others mixed in here, as well. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@316293 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-10-28Merged revisions 226304 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r226304 | tilghman | 2009-10-28 13:02:25 -0500 (Wed, 28 Oct 2009) | 2 lines Fix documentation (pointed out by TheDavidFactor on #-dev) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@226305 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-17Merged revisions 201261 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r201261 | kpfleming | 2009-06-17 07:03:25 -0500 (Wed, 17 Jun 2009) | 9 lines Correct AST_LIST_APPEND_LIST behavior when list to be appended is empty. When the list to be appended is empty, and the list to be appended to is *not*, AST_LIST_APPEND_LIST would actually cause the target list to become broken, and no longer have a pointer to its last entry. This patch fixes the problem. (reported by Stanislaw Pitucha on the asterisk-dev mailing list) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-16Merged revisions 200991 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r200991 | kpfleming | 2009-06-16 12:05:38 -0500 (Tue, 16 Jun 2009) | 11 lines Improve support for media paths that can generate multiple frames at once. There are various media paths in Asterisk (codec translators and UDPTL, primarily) that can generate more than one frame to be generated when the application calling them expects only a single frame. This patch addresses a number of those cases, at least the primary ones to solve the known problems. In addition it removes the broken TRACE_FRAMES support, fixes a number of bugs in various frame-related API functions, and cleans up various code paths affected by these changes. https://reviewboard.asterisk.org/r/175/ ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201056 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-10Modify headers and macros, according to Russell's suggestions on the -dev listTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187599 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-09Merged revisions 187428 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r187428 | tilghman | 2009-04-09 13:08:20 -0500 (Thu, 09 Apr 2009) | 8 lines Race condition between ast_cli_command() and 'module unload' could cause a deadlock. Add lock timeouts to avoid this potential deadlock. (closes issue #14705) Reported by: jamessan Patches: 20090320__bug14705.diff.txt uploaded by tilghman (license 14) Tested by: jamessan ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187483 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-09Add Doxygen documentation for API changes from 1.6.0 to 1.6.1Jeff Peeler
Copied from my review board description: This is a continuation of the API changes documentation started for describing changes between releases. Most of the API changes were pretty simple needing only to be brought to attention via the new "Asterisk API Changes" list. However, if you see anything that needs further explanation feel free to supplement what is there. The current method of documenting is to add (in the header file): \version <ver number> <description of changes> and then to add the function to the change list in doxyref.h on the AstAPIChanges page. I also made sure all the functions that were newly added were tagged with \since 1.6.1. I think this is a good habit to start both for the historical aspect as well as for the future ability to easily add a "New Asterisk API" page. Review: http://reviewboard.digium.com/r/190/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@180719 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-22Merged revisions 169943 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r169943 | tilghman | 2009-01-21 18:43:31 -0600 (Wed, 21 Jan 2009) | 9 lines AST_RWLOCK_INIT_VALUE is always defined. What we really wanted to ask is whether autoconf detected a static initializer value. This fixes rwlocks on all such platforms (mainly, Mac OS X). (closes issue #13767) Reported by: jcovert Patches: 20090121__bug13767.diff.txt uploaded by Corydon76 (license 14) Tested by: jcovert, Corydon76 ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@169944 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-29incorporates r159808 from branches/1.4:Kevin P. Fleming
------------------------------------------------------------------------ r159808 | kpfleming | 2008-11-29 10:58:29 -0600 (Sat, 29 Nov 2008) | 7 lines update dev-mode compiler flags to match the ones used by default on Ubuntu Intrepid, so all developers will see the same warnings and errors since this branch already had some printf format attributes, enable checking for them and tag functions that didn't have them format attributes in a consistent way ------------------------------------------------------------------------ in addition: move some format attributes from main/utils.c to the header files they belong in, and fix up references to the relevant functions based on new compiler warnings git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@159818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-26Simplify new macro, simplify configfile logic, now that list is sortedTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@111132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-26Add a linkedlist macro that maintains a sorted listTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@111036 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-08improve linked-list macros in two ways:Kevin P. Fleming
- the *_CURRENT macros no longer need the list head pointer argument - add AST_LIST_MOVE_CURRENT to encapsulate the remove/add operation when moving entries between lists git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89106 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-25Merged revisions 87069 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r87069 | kpfleming | 2007-10-25 18:03:11 -0500 (Thu, 25 Oct 2007) | 2 lines appending one list to another should leave the first list empty, and not require the user to do that ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@87070 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-06Merged revisions 78184 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r78184 | russell | 2007-08-06 11:50:54 -0500 (Mon, 06 Aug 2007) | 5 lines Fix the return value of AST_LIST_REMOVE(). This shouldn't be causing any problems, though, because the only code that uses the return value only checks to see if it is NULL. (closes issue #10390, pointed out by mihai) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78185 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-05Fix building res_crypto on systems that init locks with constructors.Russell Bryant
The problem was that res_crypto now has a RWLIST named "keys". The macro for defining this list defines a function used as a constructor for the list called "init_keys". However, there was another function called init_keys in this module for a CLI command. The fix is just to prepend the generated functions with underscores. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78138 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-16Merge a bunch of doxygen updates to header files. This includes changes toRussell Bryant
use the \retval tag for documenting return values, fixing various warnings when generating the documentation, and various other things. (closes issue #10203, snuffy) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75164 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-06Merged revisions 67716 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r67716 | russell | 2007-06-06 11:55:59 -0500 (Wed, 06 Jun 2007) | 13 lines Merged revisions 67715 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r67715 | russell | 2007-06-06 11:40:51 -0500 (Wed, 06 Jun 2007) | 5 lines We have some bug reports showing crashes due to a double free of a channel. Add a sanity check to ast_channel_free() to make sure we don't go on trying to free a channel that wasn't found in the channel list. (issue #8850, and others...) ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67717 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-05Merged revisions 67492 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r67492 | russell | 2007-06-05 15:53:28 -0500 (Tue, 05 Jun 2007) | 16 lines This bug has been hanging over my head ever since I wrote this SLA code. Every time I tried to go debug it by adding some debug output, the behavior would change. It turns out I wasn't crazy. I had the following piece of code: if (remove) AST_LIST_REMOVE_CURRENT(...); Well, AST_LIST_REMOVE_CURRENT was not wrapped in braces, so my conditional statement didn't do much good at all. It always ran at least all of the macro minus the first statement, so I was seeing list entries magically disappear when they weren't supposed to. After many hours of debugging, I have come to this extremely irritating fix. :) (issues #9581, #9497) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-17Merged revisions 64820 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r64820 | tilghman | 2007-05-17 16:19:34 -0500 (Thu, 17 May 2007) | 10 lines Merged revisions 64819 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r64819 | tilghman | 2007-05-17 16:14:36 -0500 (Thu, 17 May 2007) | 2 lines How is it that we never caught that this is returning the opposite of our documentation, until now? ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@64821 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-02Add AST_RWLIST_* set of macros which implement linked lists using read/write ↵Joshua Colp
locks, the actual list manipulation is still done via the old macros. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46967 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-30Merged revisions 46511 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r46511 | kpfleming | 2006-10-30 15:46:07 -0600 (Mon, 30 Oct 2006) | 2 lines ensure that items removed from a list are always unlinked from the list (next pointer set to NULL) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46512 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-06Merged revisions 44631 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r44631 | kpfleming | 2006-10-06 16:28:03 -0500 (Fri, 06 Oct 2006) | 2 lines ensure that mutex locks inside list heads are initialized properly on platforms that require constructor initialization (issue #8029, patch from timrobbins) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44632 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-08-24Merged revisions 40994 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r40994 | russell | 2006-08-24 15:41:26 -0400 (Thu, 24 Aug 2006) | 11 lines Fix a few issues related to the handling of channel variables - in pbx_builtin_serialize_variables(), the variable list traversal would stop on a variables with empty name/values, which is not appropriate - When removing the GROUP variables, use AST_LIST_REMOVE_CURRENT instead of AST_LIST_REMOVE - During masquerading, when copying the variables list from one channel to the other, using AST_LIST_INSERT_TAIL is not valid for appending a whole list. It leaves the tail pointer of the list invalid. Introduce a new macro, AST_LIST_APPEND_LIST that appends a list properly. (issue #7802, softins) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@40995 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-08-21merge new_loader_completion branch, including (at least):Kevin P. Fleming
- restructured build tree and makefiles to eliminate recursion problems - support for embedded modules - support for static builds - simpler cross-compilation support - simpler module/loader interface (no exported symbols) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@40722 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-06-03Merged revisions 31738 via svnmerge from BJ Weschke
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r31738 | bweschke | 2006-06-03 10:48:13 -0400 (Sat, 03 Jun 2006) | 3 lines Fix doxygen comment about AST_LIST_HEAD_INIT_NOLOCK ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@31739 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-05-23restore AST_LIST_HEAD_INIT (with no users in the tree right now)Kevin P. Fleming
update ast_mutex_init to allow mutexes that are all zero bytes to be initialized (in the case of a dynamically-allocated structure containing a mutex) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@29727 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-05-13simplify conference user list handlingRussell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@27153 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-05-11 - The recent change to linklists.h broke the build on linux for some reason.Russell Bryant
So, I have removed all of the uses of AST_LIST_HEAD_INIT and replaced them with the equivalent static initializations. - On passing, fix a memory leak in the unload_module() function of chan_agent. The agents list mutex was never destroyed, and the elements in the agents list were not freed. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-05-11properly initialize non-static locks.Luigi Rizzo
(Thanks Dinesh for tracking the bug and fixing it) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26954 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-11Merged revisions 19303 via svnmerge from Joshua Colp
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r19303 | file | 2006-04-11 17:46:38 -0300 (Tue, 11 Apr 2006) | 2 lines Minor linked lists bug fix. When you're dealing with swapping entries around a lot it can cause a seg fault. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@19304 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-04Does nobody know how to write a linked list properly? I mean seriously!Mark Spencer
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@17183 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-03-29Merged revisions 15896 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r15896 | kpfleming | 2006-03-28 18:32:10 -0600 (Tue, 28 Mar 2006) | 2 lines ensure that list traversal loops which skip entries properly update the 'previous entry' pointer so when entries _are_ removed the list does not get damaged ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@15897 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-22bug in the linkedlists macros where the prev node Matt O'Gorman
was improperly managed when doing removals or insertions. also solved issues with app_voicemail init. and reload solves bug #6557 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10766 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-16Bug 6515 - extra semicolonTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10338 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-15Define the initial values separate from the STATIC definitionsTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10255 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-14more list macro conversion (issue #6361, plus documentation for new macro)Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10067 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-01-11- add AST_LIST_HEAD_NOLOCK_STATIC, similar to AST_LIST_HEAD_STATIC, but ↵Russell Bryant
without the lock! - store registered channel backends using linked list macros git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-12-17Merged revisions 7508 via svnmerge fromTilghman Lesher
/branches/1.2 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7509 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-12-12TypoTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7434 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-12-11Bug 5965 - major bug in AST_LIST_REMOVETilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7428 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-11-29remove extraneous svn:executable propertiesKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7221 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-11-11issue #5669Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7067 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-10-31fix various bugs related to list handling of channel variables (issue #5548)Kevin P. Fleming
use nolock lists for channel variables, since no locks are needed (these lists are either temporary or protected by the channel's own lock) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6900 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-10-28add 'tail' pointer to list heads, so that common 'insert-to-tail' operations ↵Kevin P. Fleming
can run more quickly add option for list heads without embedded locks git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6875 65c4cc65-6c06-0410-ace0-fbb531ad65f3