]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Use IN_SET() more
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 2 Apr 2024 16:06:24 +0000 (18:06 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 2 Apr 2024 16:08:15 +0000 (18:08 +0200)
src/cryptsetup/cryptsetup.c
src/shared/pkcs11-util.c
src/shared/ptyfwd.c

index 7099f68f88bce3d3c4367120ee3132c4e6718e1e..34ad9ebd1455e3bdeee63c16291ea397d1563ce5 100644 (file)
@@ -530,7 +530,7 @@ static int parse_one_option(const char *option) {
                  * - text descriptions prefixed with "%:" or "%keyring:".
                  * - text description with no prefix.
                  * - numeric keyring id (ignored in current patch set). */
-                if (*val == '@' || *val == '%')
+                if (IN_SET(*val, '@', '%'))
                         keyring = strndup(val, sep - val);
                 else
                         /* add type prefix if missing (crypt_set_keyring_to_link() expects it) */
index e6feba44bdf559e7058909253ee5ca042586de64..8727fe248454c01718a340cddedd84b2831cc89b 100644 (file)
@@ -1711,7 +1711,7 @@ static int pkcs11_acquire_public_key_callback(
                 switch (attributes[i].type) {
                 case CKA_CLASS: {
                         CK_OBJECT_CLASS requested_class = *((CK_OBJECT_CLASS*) attributes[i].pValue);
-                        if (requested_class != CKO_PUBLIC_KEY && requested_class != CKO_CERTIFICATE)
+                        if (!IN_SET(requested_class, CKO_PUBLIC_KEY, CKO_CERTIFICATE))
                                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                                        "Selected PKCS#11 object is not a public key or certificate, refusing.");
                         break;
@@ -1743,7 +1743,7 @@ static int pkcs11_acquire_public_key_callback(
                 candidate_attributes[0].ulValueLen = sizeof(class);
                 candidate_attributes[1].ulValueLen = sizeof(type);
                 rv = m->C_GetAttributeValue(session, candidate, candidate_attributes, ELEMENTSOF(candidate_attributes));
-                if (rv != CKR_OK && rv != CKR_ATTRIBUTE_TYPE_INVALID)
+                if (!IN_SET(rv, CKR_OK, CKR_ATTRIBUTE_TYPE_INVALID))
                         return log_error_errno(SYNTHETIC_ERRNO(EIO),
                                 "Failed to get attributes of a selected candidate: %s", sym_p11_kit_strerror(rv));
 
index bdbd79087ca27238f0ec412d20d83342b4983c0d..7bd8dd6d89889850cb720106dbcbed184f345ac3 100644 (file)
@@ -478,7 +478,7 @@ static int pty_forward_ansi_process(PTYForward *f, size_t offset) {
                                  * since we cannot lookahead to see if the Esc is followed by a \
                                  * we cut a corner here and assume it will be \. */
 
-                                if (c == '\x07' || c == '\x1b') {
+                                if (IN_SET(c, '\x07', '\x1b')) {
                                         r = insert_window_title_fix(f, i+1);
                                         if (r < 0)
                                                 return r;