Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[picolib/ctype] Fix for conflict between C/POSIX for iswdigit() #22

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions newlib/libc/ctype/iswalnum.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,5 @@ No supporting OS subroutines are required.
int
iswalnum (wint_t c)
{
#ifdef _MB_CAPABLE
return iswalnum_l (c, 0);
#else
return c < (wint_t)0x100 ? isalnum (c) : 0;
#endif
}
9 changes: 9 additions & 0 deletions newlib/libc/ctype/iswdigit_l.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@ Copyright (c) 2016 Corinna Vinschen <corinna@vinschen.de>
Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling
*/
#define _DEFAULT_SOURCE
#include <ctype.h>
#include <wctype.h>
#include "local.h"
#include "categories.h"

int
iswdigit_l (wint_t c, struct __locale_t *locale)
{
(void) locale;
#ifdef _MB_CAPABLE
c = _jp2uc_l (c, locale);
enum category cat = category (c);
return cat == CAT_Nd; // Decimal_Number
#else
return c >= (wint_t)'0' && c <= (wint_t)'9';
#endif /* _MB_CAPABLE */
}
Loading