unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] compat: probe for strcasestr more thoroughly
@ 2023-08-26 14:53 michaeljgruber+grubix+git
  2023-08-27 16:38 ` Tomi Ollila
  2023-08-31 13:12 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: michaeljgruber+grubix+git @ 2023-08-26 14:53 UTC (permalink / raw)
  To: notmuch; +Cc: Michael J Gruber, Thomas Schneider, Florian Weimer, Tomi Ollila

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-31 13:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-26 14:53 [PATCH] compat: probe for strcasestr more thoroughly michaeljgruber+grubix+git
2023-08-27 16:38 ` Tomi Ollila
2023-08-31 13:12 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).