mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-18 18:58:22 +00:00
improve linked-list macros in two ways:
- 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
This commit is contained in:
@@ -132,7 +132,7 @@ static int srv_callback(void *context, unsigned char *answer, int len, unsigned
|
||||
if (current->priority <= entry->priority)
|
||||
continue;
|
||||
|
||||
AST_LIST_INSERT_BEFORE_CURRENT(&c->entries, entry, list);
|
||||
AST_LIST_INSERT_BEFORE_CURRENT(entry, list);
|
||||
entry = NULL;
|
||||
break;
|
||||
}
|
||||
@@ -167,8 +167,7 @@ static void process_weights(struct srv_context *context)
|
||||
if (current->priority != cur_priority)
|
||||
break;
|
||||
|
||||
AST_LIST_REMOVE_CURRENT(&context->entries, list);
|
||||
AST_LIST_INSERT_TAIL(&temp_list, current, list);
|
||||
AST_LIST_MOVE_CURRENT(&temp_list, list);
|
||||
}
|
||||
AST_LIST_TRAVERSE_SAFE_END;
|
||||
|
||||
@@ -190,8 +189,7 @@ static void process_weights(struct srv_context *context)
|
||||
if (current->weight < random_weight)
|
||||
continue;
|
||||
|
||||
AST_LIST_REMOVE_CURRENT(&temp_list, list);
|
||||
AST_LIST_INSERT_TAIL(&newlist, current, list);
|
||||
AST_LIST_MOVE_CURRENT(&newlist, list);
|
||||
}
|
||||
AST_LIST_TRAVERSE_SAFE_END;
|
||||
}
|
||||
|
Reference in New Issue
Block a user