From b0d341442c7cd63f3e1c49c76cb40e870c4d5b19 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 17 Aug 2016 09:40:28 +0200 Subject: [PATCH] Constify __locale_ctype_ptr and __locale_ctype_ptr_l Remove _MB_CAPABLE-only _CONST in ctype.h Signed-off-by: Corinna Vinschen --- newlib/libc/include/ctype.h | 7 ++----- newlib/libc/locale/locale.c | 6 +++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h index d34b8e5cd..31577d16e 100644 --- a/newlib/libc/include/ctype.h +++ b/newlib/libc/include/ctype.h @@ -66,10 +66,7 @@ extern int toascii_l (int __c, locale_t __l); #define _X 0100 #define _B 0200 -#ifndef _MB_CAPABLE -_CONST -#endif -char *__locale_ctype_ptr (void); +const char *__locale_ctype_ptr (void); # define __CTYPE_PTR (__locale_ctype_ptr ()) #ifndef __cplusplus @@ -103,7 +100,7 @@ char *__locale_ctype_ptr (void); #endif #if __POSIX_VISIBLE >= 200809 -char *__locale_ctype_ptr_l (locale_t); +const char *__locale_ctype_ptr_l (locale_t); #define __ctype_lookup_l(__c,__l) ((__locale_ctype_ptr_l(__l)+sizeof(""[__c]))[(int)(__c)]) #define isalpha_l(__c,__l) (__ctype_lookup_l(__c,__l)&(_U|_L)) diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index 795e163e0..58c28490c 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -982,8 +982,8 @@ _DEFUN_VOID (__locale_mb_cur_max) #endif } -char * -_DEFUN_VOID (__locale_ctype_ptr) +const char * +__locale_ctype_ptr (void) { /* Only check if the current thread/reent has a locale. ctype_ptr is unused in __global_locale, rather the global variable __ctype_ptr__ is used. */ @@ -992,7 +992,7 @@ _DEFUN_VOID (__locale_ctype_ptr) : __ctype_ptr__; } -char * +const char * __locale_ctype_ptr_l (struct __locale_t *locale) { extern char *__ctype_ptr__;