summaryrefslogtreecommitdiff
path: root/funcs/func_devstate.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2007-04-11 15:25:43 +0000
committerRussell Bryant <russell@russellbryant.com>2007-04-11 15:25:43 +0000
commit0df4004ee5029b0ab9564c2bfc2f34b7da1cca4c (patch)
tree2ca15fcdea4312291aa40d6acfc99cd9ba283c5f /funcs/func_devstate.c
parent6b033eea0460d76f39f1838704a871b402d9898a (diff)
Add a minor loop optimization to the custom device state callback. Once the
correct device is found, it should just break out of the loop ... git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@61429 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs/func_devstate.c')
-rw-r--r--funcs/func_devstate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/funcs/func_devstate.c b/funcs/func_devstate.c
index c6429a853..6b0e7a3f9 100644
--- a/funcs/func_devstate.c
+++ b/funcs/func_devstate.c
@@ -99,8 +99,10 @@ static enum ast_device_state custom_devstate_callback(const char *data)
AST_RWLIST_RDLOCK(&custom_devices);
AST_RWLIST_TRAVERSE(&custom_devices, dev, entry) {
- if (!strcasecmp(dev->name, data))
+ if (!strcasecmp(dev->name, data)) {
state = dev->state;
+ break;
+ }
}
AST_RWLIST_UNLOCK(&custom_devices);