From 0df4004ee5029b0ab9564c2bfc2f34b7da1cca4c Mon Sep 17 00:00:00 2001
From: Russell Bryant <russell@russellbryant.com>
Date: Wed, 11 Apr 2007 15:25:43 +0000
Subject: [PATCH] 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
---
 funcs/func_devstate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/funcs/func_devstate.c b/funcs/func_devstate.c
index c6429a8536..6b0e7a3f94 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);
 
-- 
GitLab