]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic/string-table: reduce variable scope
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 16 Jul 2020 13:57:36 +0000 (15:57 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 16 Jul 2020 16:38:03 +0000 (18:38 +0200)
src/basic/string-table.c

index 34931b03d8c4a0ce70e6433e126fc0116a182eda..0168cff886dcf262f2915ebd73f2b5a7ebcdca55 100644 (file)
@@ -4,12 +4,10 @@
 #include "string-util.h"
 
 ssize_t string_table_lookup(const char * const *table, size_t len, const char *key) {
-        size_t i;
-
         if (!key)
                 return -1;
 
-        for (i = 0; i < len; ++i)
+        for (size_t i = 0; i < len; ++i)
                 if (streq_ptr(table[i], key))
                         return (ssize_t) i;