From: Felix Buehler Date: Sun, 1 Jul 2018 22:03:13 +0000 (+0200) Subject: make format_placeholders case-sensitive X-Git-Tag: 4.16~64^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=37ea56c221fa932d03315f575569cabaebf4ba5f;p=i3%2Fi3 make format_placeholders case-sensitive --- diff --git a/libi3/format_placeholders.c b/libi3/format_placeholders.c index 59e94781..770e383d 100644 --- a/libi3/format_placeholders.c +++ b/libi3/format_placeholders.c @@ -11,8 +11,8 @@ #include #include -#ifndef STARTS_WITH -#define STARTS_WITH(string, needle) (strncasecmp((string), (needle), strlen((needle))) == 0) +#ifndef CS_STARTS_WITH +#define CS_STARTS_WITH(string, needle) (strncmp((string), (needle), strlen((needle))) == 0) #endif /* @@ -28,7 +28,7 @@ char *format_placeholders(char *format, placeholder_t *placeholders, int num) { int buffer_len = strlen(format) + 1; for (char *walk = format; *walk != '\0'; walk++) { for (int i = 0; i < num; i++) { - if (!STARTS_WITH(walk, placeholders[i].name)) + if (!CS_STARTS_WITH(walk, placeholders[i].name)) continue; buffer_len = buffer_len - strlen(placeholders[i].name) + strlen(placeholders[i].value); @@ -48,7 +48,7 @@ char *format_placeholders(char *format, placeholder_t *placeholders, int num) { bool matched = false; for (int i = 0; i < num; i++) { - if (!STARTS_WITH(walk, placeholders[i].name)) { + if (!CS_STARTS_WITH(walk, placeholders[i].name)) { continue; }