Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1771849171.git.alx@kernel.org>
Date: Mon, 23 Feb 2026 13:22:17 +0100
From: Alejandro Colomar <alx@...nel.org>
To: musl@...ts.openwall.com
Cc: Paul Eggert <eggert@...ucla.edu>, Bruno Haible <bruno@...sp.org>, 
	Joseph Myers <josmyers@...hat.com>, Alejandro Colomar <alx@...nel.org>, 
	Markus Wichmann <nullplan@....net>, Rich Felker <dalias@...c.org>, 
	Luca Kellermann <mailto.luca.kellermann@...il.com>
Subject: [PATCH v7 0/1] Implement QChar and QVoid wrappers standardized in C23

Hi!

I realized a mistake in the mem*() wrappers: I was missing the 'n'
parameter.  I've rewritten all of them as variadic macros, which makes
it impossible to make such mistakes.  The underlying functions control
the actual number of parameters.  See range-diff below.


Have a lovely day!
Alex


Alejandro Colomar (1):
  include/string.h: Implement QChar and QVoid wrappers standardized in
    C23

 include/string.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Range-diff against v6:
1:  f55c5681e5c2 ! 1:  a32505bd8595 include/string.h: Implement QChar and QVoid wrappers standardized in C23
    @@ include/string.h: size_t strlen (const char *);
      char *strerror (int);
      
     +#if __STDC_VERSION__ >= 202311L
    -+# define memchr(p, chr)    ((__QVoidptrof(p)) memchr(p, chr))
    -+# define strchr(s, chr)    ((__QCharptrof(s)) strchr(s, chr))
    -+# define strrchr(s, chr)   ((__QCharptrof(s)) strrchr(s, chr))
    -+# define strpbrk(s, chrs)  ((__QCharptrof(s)) strpbrk(s, chrs))
    -+# define strstr(s, str)    ((__QCharptrof(s)) strstr(s, str))
    ++# define memchr(p, ...)   ((__QVoidptrof(p)) memchr(p, __VA_ARGS__))
    ++# define strchr(s, ...)   ((__QCharptrof(s)) strchr(s, __VA_ARGS__))
    ++# define strrchr(s, ...)  ((__QCharptrof(s)) strrchr(s, __VA_ARGS__))
    ++# define strpbrk(s, ...)  ((__QCharptrof(s)) strpbrk(s, __VA_ARGS__))
    ++# define strstr(s, ...)   ((__QCharptrof(s)) strstr(s, __VA_ARGS__))
     +#endif
     +
      #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
    @@ include/string.h: char *strerror_l (int, locale_t);
      size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
      void *memmem(const void *, size_t, const void *, size_t);
     +# if __STDC_VERSION__ >= 202311L
    -+#  define memmem(p, mem)  ((__QVoidptrof(p)) memmem(p, mem))
    ++#  define memmem(p, ...)  ((__QVoidptrof(p)) memmem(p, __VA_ARGS__))
     +# endif
      #endif
      
    @@ include/string.h: char *strchrnul(const char *, int);
      void *memrchr(const void *, int, size_t);
      void *mempcpy(void *, const void *, size_t);
     +# if __STDC_VERSION__ >= 202311L
    -+#  define strchrnul(s, chr)   ((__QCharptrof(s)) strchrnul(s, chr))
    -+#  define strcasestr(s, str)  ((__QCharptrof(s)) strcasestr(s, str))
    -+#  define memrchr(p, chr)     ((__QVoidptrof(p)) memrchr(p, chr))
    ++#  define strchrnul(s, ...)   ((__QCharptrof(s)) strchrnul(s, __VA_ARGS__))
    ++#  define strcasestr(s, ...)  ((__QCharptrof(s)) strcasestr(s, __VA_ARGS__))
    ++#  define memrchr(p, ...)     ((__QVoidptrof(p)) memrchr(p, __VA_ARGS__))
     +# endif
      #endif
      
-- 
2.51.0

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.