[PATCH] compat: probe for strcasestr more thoroughly

Subject: [PATCH] compat: probe for strcasestr more thoroughly

Date: Sat, 26 Aug 2023 16:53:12 +0200

To: notmuch@notmuchmail.org

Cc: Michael J Gruber, Thomas Schneider, Florian Weimer, Tomi Ollila

From: michaeljgruber+grubix+git@gmail.com


From: Michael J Gruber <git@grubix.eu>

Depending on compiler (gcc, g++, clang) and standard options (c99, c11),
string.h may or may not include strings.h, leading to possibly missing
or conflicting declarations of strcasestr.

Include both so that both detection and compilation phases use the same
(possibly optimised) implementations.

Suggested-by: Thomas Schneider <qsx@chaotikum.eu>
Suggested-by: Florian Weimer <fweimer@redhat.com>
Suggested-by: Tomi Ollila <tomi.ollila@iki.fi>
---
This is related to the discussion here:
https://nmbug.notmuchmail.org/nmweb/show/20221202191908.848227-1-qsx%40chaotikum.eu>

We've been carrying FW's version of the patch in Fedora since January.
The one here is TO's version of TS's original and tested in Fedora.

 compat/have_strcasestr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compat/have_strcasestr.c b/compat/have_strcasestr.c
index 3cd1838d..8e004572 100644
--- a/compat/have_strcasestr.c
+++ b/compat/have_strcasestr.c
@@ -1,5 +1,6 @@
 #define _GNU_SOURCE
-#include <strings.h>
+#include <strings.h> /* strcasecmp() in POSIX */
+#include <string.h> /* strcasecmp() in *BSD */
 
 int
 main ()
-- 
2.42.0.290.gfcfb41f205

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: