Skip to content

Commit

Permalink
Annotate mbstowcs_nonfatal() with restrict
Browse files Browse the repository at this point in the history
The arguments to our mbrtowc(3) wrapper should not alias, since they
also must not for mbrtowc(3).

Might help some compilers optimizing the code.
  • Loading branch information
cgzones committed May 11, 2024
1 parent ef07d6e commit 314d693
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion RichString.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void RichString_rewind(RichString* this, int count) {

#ifdef HAVE_LIBNCURSESW

static size_t mbstowcs_nonfatal(wchar_t* dest, const char* src, size_t n) {
static size_t mbstowcs_nonfatal(wchar_t* restrict dest, const char* restrict src, size_t n) {
size_t written = 0;
mbstate_t ps = { 0 };
bool broken = false;
Expand Down

0 comments on commit 314d693

Please sign in to comment.