summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorAndré Goddard Rosa <andre.goddard@gmail.com>2010-06-12 11:40:20 -0300
committerJean-Baptiste Queru <jbq@google.com>2010-06-14 09:59:34 -0700
commit8182829ccb46fc5b043ea258672602dc2928dee2 (patch)
treeba10b7fce8464eaaf2cf02de07dad22bfcd9fe71 /adb
parent8e78dc64d2fedccc77966b0636f7530f452dc7d5 (diff)
downloadsystem_core-8182829ccb46fc5b043ea258672602dc2928dee2.zip
system_core-8182829ccb46fc5b043ea258672602dc2928dee2.tar.gz
system_core-8182829ccb46fc5b043ea258672602dc2928dee2.tar.bz2
adb: optimize socket-list-walking code
Change-Id: I8bbb8b671c1ce7a2ce736b60b0cdb7b21ccdc372 Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Diffstat (limited to 'adb')
-rw-r--r--adb/sockets.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/adb/sockets.c b/adb/sockets.c
index 6d1c89b..43925e4 100644
--- a/adb/sockets.c
+++ b/adb/sockets.c
@@ -65,8 +65,11 @@ asocket *find_local_socket(unsigned id)
asocket *result = NULL;
adb_mutex_lock(&socket_list_lock);
- for(s = local_socket_list.next; s != &local_socket_list && !result; s = s->next) {
- if(s->id == id) result = s;
+ for (s = local_socket_list.next; s != &local_socket_list; s = s->next) {
+ if (s->id == id) {
+ result = s;
+ break;
+ }
}
adb_mutex_unlock(&socket_list_lock);