]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Two small cleanups
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 29 Nov 2016 19:42:57 +0000 (14:42 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 30 Nov 2016 01:34:08 +0000 (20:34 -0500)
src/basic/util.c
src/libsystemd/sd-hwdb/sd-hwdb.c

index c1b5ca1ef7b7d6f9c0b0717be62746edb2787a34..d0424e539252a0b906dc9955c191eddcd38a9142 100644 (file)
@@ -493,7 +493,7 @@ void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
         u = nmemb;
         while (l < u) {
                 idx = (l + u) / 2;
-                p = (void *)(((const char *) base) + (idx * size));
+                p = (const char *) base + idx * size;
                 comparison = compar(key, p, arg);
                 if (comparison < 0)
                         u = idx;
index 719e3505c123b72c853c43cb2827bd16ba9d9715..811a60f0c3cecca01e8f0eeddf747f33d11b6127 100644 (file)
@@ -234,7 +234,7 @@ static int trie_search_f(sd_hwdb *hwdb, const char *search) {
                         uint8_t c;
 
                         for (; (c = trie_string(hwdb, node->prefix_off)[p]); p++) {
-                                if (c == '*' || c == '?' || c == '[')
+                                if (IN_SET(c, '*', '?', '['))
                                         return trie_fnmatch_f(hwdb, node, p, &buf, search + i + p);
                                 if (c != search[i + p])
                                         return 0;