git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] Add strchrnul()

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 9, 2007, 01:21 UTC
Message-ID
<Pine.LNX.4.64.0711090119430.4362@racer.site>
In-Reply-To
<4733AEA0.1060602@lsrfire.ath.cx>
Hi,
On Fri, 9 Nov 2007, Ren? Scharfe wrote:
Show 68 quoted lines
> diff --git a/Makefile b/Makefile
> index 0d5590f..578c999 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -30,6 +30,8 @@ all::
>  #
>  # Define NO_MEMMEM if you don't have memmem.
>  #
> +# Define NO_STRCHRNUL if you don't have strchrnul.
> +#
>  # Define NO_STRLCPY if you don't have strlcpy.
>  #
>  # Define NO_STRTOUMAX if you don't have strtoumax in the C library.
> @@ -406,6 +408,7 @@ ifeq ($(uname_S),Darwin)
>  	OLD_ICONV = UnfortunatelyYes
>  	NO_STRLCPY = YesPlease
>  	NO_MEMMEM = YesPlease
> +	NO_STRCHRNUL = YesPlease
>  endif
>  ifeq ($(uname_S),SunOS)
>  	NEEDS_SOCKET = YesPlease
> @@ -413,6 +416,7 @@ ifeq ($(uname_S),SunOS)
>  	SHELL_PATH = /bin/bash
>  	NO_STRCASESTR = YesPlease
>  	NO_MEMMEM = YesPlease
> +	NO_STRCHRNUL = YesPlease
>  	NO_HSTRERROR = YesPlease
>  	ifeq ($(uname_R),5.8)
>  		NEEDS_LIBICONV = YesPlease
> @@ -438,6 +442,7 @@ ifeq ($(uname_O),Cygwin)
>  	NO_D_INO_IN_DIRENT = YesPlease
>  	NO_STRCASESTR = YesPlease
>  	NO_MEMMEM = YesPlease
> +	NO_STRCHRNUL = YesPlease
>  	NO_SYMLINK_HEAD = YesPlease
>  	NEEDS_LIBICONV = YesPlease
>  	NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
> @@ -452,12 +457,14 @@ endif
>  ifeq ($(uname_S),FreeBSD)
>  	NEEDS_LIBICONV = YesPlease
>  	NO_MEMMEM = YesPlease
> +	NO_STRCHRNUL = YesPlease
>  	BASIC_CFLAGS += -I/usr/local/include
>  	BASIC_LDFLAGS += -L/usr/local/lib
>  endif
>  ifeq ($(uname_S),OpenBSD)
>  	NO_STRCASESTR = YesPlease
>  	NO_MEMMEM = YesPlease
> +	NO_STRCHRNUL = YesPlease
>  	NEEDS_LIBICONV = YesPlease
>  	BASIC_CFLAGS += -I/usr/local/include
>  	BASIC_LDFLAGS += -L/usr/local/lib
> @@ -473,6 +480,7 @@ endif
>  ifeq ($(uname_S),AIX)
>  	NO_STRCASESTR=YesPlease
>  	NO_MEMMEM = YesPlease
> +	NO_STRCHRNUL = YesPlease
>  	NO_STRLCPY = YesPlease
>  	NEEDS_LIBICONV=YesPlease
>  endif
> @@ -485,6 +493,7 @@ ifeq ($(uname_S),IRIX64)
>  	NO_SETENV=YesPlease
>  	NO_STRCASESTR=YesPlease
>  	NO_MEMMEM = YesPlease
> +	NO_STRCHRNUL = YesPlease
>  	NO_STRLCPY = YesPlease
>  	NO_SOCKADDR_STORAGE=YesPlease
>  	SHELL_PATH=/usr/gnu/bin/bash
Might be easier to define HAVE_STRCHRNUL ;-)
Show 14 quoted lines
> diff --git a/compat/strchrnul.c b/compat/strchrnul.c
> new file mode 100644
> index 0000000..51839fe
> --- /dev/null
> +++ b/compat/strchrnul.c
> @@ -0,0 +1,8 @@
> +#include "../git-compat-util.h"
> +
> +char *gitstrchrnul(const char *s, int c)
> +{
> +	while (*s && *s != c)
> +		s++;
> +	return (char *)s;
> +}
This is so short, I think it is even better to inline it.

Ciao, Dscho

Previous: René ScharfeNext: Jeff King
Message 2 of 18 in “Add strchrnul()”
  1. 1/2 Add strchrnul()René Scharfe, Nov 9, 2007
  2. Johannes SchindelinNov 9, 2007
  3. Jeff KingNov 9, 2007
  4. Andreas EricssonNov 9, 2007
  5. Jakub NarebskiNov 9, 2007
  6. Andreas EricssonNov 9, 2007
  7. Jakub NarebskiNov 9, 2007
  8. Simplify strchrnul() compat codeRené Scharfe, Nov 10, 2007
  9. Andreas EricssonNov 10, 2007
  10. Junio C HamanoNov 11, 2007
  11. Andreas EricssonNov 11, 2007
  12. David SymondsNov 12, 2007
  13. Johannes SixtNov 12, 2007
  14. David SymondsNov 12, 2007
  15. Johannes SixtNov 12, 2007
  16. David SymondsNov 12, 2007
  17. Jakub NarebskiNov 12, 2007
  18. Fix preprocessor logic that determines the availablity of strchrnul().Johannes Sixt, Nov 12, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.