]> git.mdlowis.com Git - proto/labwc.git/commitdiff
string-helpers: remove restrict qualifier
authorJohn Lindgren <john@jlindgren.net>
Fri, 4 Jul 2025 04:15:56 +0000 (00:15 -0400)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 21 Jul 2025 14:51:10 +0000 (16:51 +0200)
'restrict' is harmful as it encourages the compiler to make dangerous
assumptions while increasing cognitive load on the human programmer.

The extra 1% (or whatever) of performance here is not worth the cost.

include/common/string-helpers.h
src/common/string-helpers.c

index efa5bfd23d751083e84fe75008e72bcd993c6a8d..e49fa1107c7e66889ffa134db6a72a50f3ed09fb 100644 (file)
@@ -59,8 +59,7 @@ char *strdup_printf(const char *fmt, ...);
  * The separator is arbitrary. When the separator is NULL, a single space will
  * be used.
  */
-char *str_join(const char *const parts[],
-       const char *restrict fmt, const char *restrict sep);
+char *str_join(const char *const parts[], const char *fmt, const char *sep);
 
 /**
  * str_endswith - indicate whether a string ends with a given suffix
index f753d1a1e0266b458a728b7e64032e0117dd1c8d..f94e1dd9fafd8e55071aa3aad5d3996bcb752f53 100644 (file)
@@ -93,8 +93,7 @@ strdup_printf(const char *fmt, ...)
 }
 
 char *
-str_join(const char *const parts[],
-               const char *restrict fmt, const char *restrict sep)
+str_join(const char *const parts[], const char *fmt, const char *sep)
 {
        assert(parts);