diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-05 20:55:59 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-05 20:55:59 +0000 |
commit | 733f0e608dfcbfb7cf353b6f21adc9c87cfa3662 (patch) | |
tree | 80b8510cbe58489d2aba57c210060601214b11ce /include | |
parent | ec882bebaae52f1583b86b0032a2c55fd0ddbe0f (diff) |
Merged revisions 67492 via svnmerge from
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: http://svn.digium.com/svn/asterisk/trunk@67493 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/linkedlists.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h index 0d17574de..2c9a570c1 100644 --- a/include/asterisk/linkedlists.h +++ b/include/asterisk/linkedlists.h @@ -513,7 +513,7 @@ struct { \ the list traversal (and without having to re-traverse the list to modify the previous entry, if any). */ -#define AST_LIST_REMOVE_CURRENT(head, field) \ +#define AST_LIST_REMOVE_CURRENT(head, field) do { \ __new_prev->field.next = NULL; \ __new_prev = __list_prev; \ if (__list_prev) \ @@ -521,7 +521,8 @@ struct { \ else \ (head)->first = __list_next; \ if (!__list_next) \ - (head)->last = __list_prev; + (head)->last = __list_prev; \ + } while (0) #define AST_RWLIST_REMOVE_CURRENT AST_LIST_REMOVE_CURRENT |