Skip to content

Commit d42bab4

Browse files
committed
posix.cfg: Added support for wcsnrtombs().
1 parent 6b9ac6f commit d42bab4

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

cfg/posix.cfg

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,36 @@
1414
<not-bool/>
1515
</arg>
1616
</function>
17+
<!-- https://man7.org/linux/man-pages/man3/wcsnrtombs.3.html -->
18+
<!-- size_t wcsnrtombs(char *restrict dest, const wchar_t **restrict src, size_t nwc, size_t len, mbstate_t *restrict ps); -->
19+
<function name="wcsnrtombs">
20+
<use-retval/>
21+
<returnValue type="size_t"/>
22+
<noreturn>false</noreturn>
23+
<leak-ignore/>
24+
<arg nr="1" direction="out">
25+
<not-bool/>
26+
</arg>
27+
<arg nr="2" direction="in">
28+
<not-null/>
29+
<not-uninit/>
30+
<not-bool/>
31+
</arg>
32+
<arg nr="3" direction="in">
33+
<not-uninit/>
34+
<not-bool/>
35+
<valid>0:</valid>
36+
</arg>
37+
<arg nr="4" direction="in">
38+
<not-uninit/>
39+
<not-bool/>
40+
<valid>0:</valid>
41+
</arg>
42+
<arg nr="5" direction="in">
43+
<not-uninit/>
44+
<not-null/>
45+
</arg>
46+
</function>
1747
<!-- https://man7.org/linux/man-pages/man3/aio_read.3.html -->
1848
<!-- int aio_read(struct aiocb *aiocbp); -->
1949
<!-- https://man7.org/linux/man-pages/man3/aio_write.3.html -->

test/cfg/posix.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@
3131
#include <wchar.h>
3232
#include <string.h>
3333

34+
size_t nullPointer_wcsnrtombs(char *restrict dest, const wchar_t **restrict src, size_t nwc, size_t len, mbstate_t *restrict ps)
35+
{
36+
// It is allowed to set the first arg to NULL
37+
(void)wcsnrtombs(NULL,src,nwc,len,ps);
38+
// cppcheck-suppress nullPointer
39+
(void)wcsnrtombs(dest,NULL,nwc,len,ps);
40+
// cppcheck-suppress nullPointer
41+
(void)wcsnrtombs(dest,src,nwc,len,NULL);
42+
return wcsnrtombs(dest,src,nwc,len,ps);
43+
}
44+
3445
int nullPointer_wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
3546
{
3647
// cppcheck-suppress nullPointer

0 commit comments

Comments
 (0)