Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1764078543.git.alx@kernel.org>
Date: Tue, 25 Nov 2025 14:51:50 +0100
From: Alejandro Colomar <alx@...nel.org>
To: musl@...ts.openwall.com
Cc: Alejandro Colomar <alx@...nel.org>
Subject: [PATCH v1 0/1] include/string.h: Implement QChar wrappers
 standardized in C23

Hi!

I've implemented the QChar const-correct macro wrappers around string
APIs.  These were standardized in ISO C23.

I haven't implemented the QVoid ones, as they're more difficult to
implement.

Here's a small test I used to verify that this works.

	alx@...uan:~/tmp$ cat strchr.c 
	#include <stdio.h>
	#include <string.h>

	int
	main(int argc, const char *argv[argc + 1])
	{
		char *p;

		p = strchr(argv[0], 'u');
		puts(p);

		const char *cp;

		cp = strchr(argv[0], 'u');
		puts(cp);
	}
	alx@...uan:~/tmp$ gcc strchr.c 
	alx@...uan:~/tmp$ ./a.out 
	ut
	ut
	alx@...uan:~/tmp$ gcc -I /opt/local/musl/libc/qchar/include/ strchr.c 
	strchr.c: In function ‘main’:
	strchr.c:9:11: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
	    9 |         p = strchr(argv[0], 'u');
	      |           ^
	alx@...uan:~/tmp$ ./a.out 
	ut
	ut


Have a lovely day!
Alex

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

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

Range-diff against v0:
-:  -------- > 1:  3cf2501c include/string.h: Implement QChar wrappers standardized in C23
-- 
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.