unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: michaeljgruber+grubix+git@gmail.com
To: notmuch@notmuchmail.org
Cc: Michael J Gruber <git@grubix.eu>,
	Thomas Schneider <qsx@chaotikum.eu>,
	Florian Weimer <fweimer@redhat.com>,
	Tomi Ollila <tomi.ollila@iki.fi>
Subject: [PATCH] compat: probe for strcasestr more thoroughly
Date: Sat, 26 Aug 2023 16:53:12 +0200	[thread overview]
Message-ID: <bef00238ada47d305374ed1002bc9ffe813a81ee.1693061240.git.git@grubix.eu> (raw)

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

             reply	other threads:[~2023-08-26 14:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-26 14:53 michaeljgruber+grubix+git [this message]
2023-08-27 16:38 ` [PATCH] compat: probe for strcasestr more thoroughly Tomi Ollila
2023-08-31 13:12 ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bef00238ada47d305374ed1002bc9ffe813a81ee.1693061240.git.git@grubix.eu \
    --to=michaeljgruber+grubix+git@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=git@grubix.eu \
    --cc=notmuch@notmuchmail.org \
    --cc=qsx@chaotikum.eu \
    --cc=tomi.ollila@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).