]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bsod: do not use STRLEN
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 8 Dec 2023 08:56:43 +0000 (09:56 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 30 Jan 2024 09:11:07 +0000 (10:11 +0100)
The compiler optimizes strlen away, so we can use the simplest form that is
type safe and more natural. STRLEN is only for array initialization.

src/journal/bsod.c

index a88cb66b81de05ce6862df2e43ba2967a91e83d3..059e255ea4636446dd867e5ef3598ded5b17465c 100644 (file)
@@ -103,7 +103,7 @@ static int acquire_first_emergency_log_message(char **ret) {
         if (r < 0)
                 return log_error_errno(r, "Failed to read journal message: %m");
 
-        message = memdup_suffix0((const char*)d + STRLEN("MESSAGE="), l - STRLEN("MESSAGE="));
+        message = memdup_suffix0((const char*)d + strlen("MESSAGE="), l - strlen("MESSAGE="));
         if (!message)
                 return log_oom();