Mercurial > unleashed
changeset 20546:037e9729c6e3
libc: remove __wcstok_xpg5, __wcsftime_xpg5 & always expose standard versions
author | Lauri Tirkkonen <lotheac@iki.fi> |
---|---|
date | Tue, 07 May 2019 00:52:58 +0000 |
parents | a25ea9211adc |
children | 4da62e997ede |
files | include/iso/wchar_iso.h usr/src/lib/libc/inc/mse_int.h usr/src/lib/libc/port/i18n/getwchar.c usr/src/lib/libc/port/i18n/putwchar.c usr/src/lib/libc/port/i18n/wstok.c usr/src/lib/libc/port/locale/fgetwc.c usr/src/lib/libc/port/locale/fgetws.c usr/src/lib/libc/port/locale/fputwc.c usr/src/lib/libc/port/locale/fputws.c usr/src/lib/libc/port/locale/fwide.c usr/src/lib/libc/port/locale/ungetwc.c usr/src/lib/libc/port/locale/wcsftime.c usr/src/lib/libc/port/mapfile-vers |
diffstat | 13 files changed, 12 insertions(+), 101 deletions(-) [+] |
line wrap: on
line diff
--- a/include/iso/wchar_iso.h Fri May 03 20:35:27 2019 +0000 +++ b/include/iso/wchar_iso.h Tue May 07 00:52:58 2019 +0000 @@ -192,28 +192,10 @@ extern wchar_t *wcsrchr(const wchar_t *, wchar_t); #endif /* __cplusplus >= 199711L */ -#if (!defined(_MSE_INT_H)) -#if defined(_XPG4) && !defined(_XPG5) /* XPG4 or XPG4v2 */ -extern wchar_t *wcstok(wchar_t *, const wchar_t *); -extern size_t wcsftime(wchar_t *, size_t, const char *, const struct tm *); -#else /* XPG4 or XPG4v2 */ -#ifdef __PRAGMA_REDEFINE_EXTNAME -#pragma redefine_extname wcstok __wcstok_xpg5 -#pragma redefine_extname wcsftime __wcsftime_xpg5 extern wchar_t *wcstok(wchar_t *_RESTRICT_KYWD, const wchar_t *_RESTRICT_KYWD, wchar_t **_RESTRICT_KYWD); extern size_t wcsftime(wchar_t *_RESTRICT_KYWD, size_t, const wchar_t *_RESTRICT_KYWD, const struct tm *_RESTRICT_KYWD); -#else /* __PRAGMA_REDEFINE_EXTNAME */ -extern wchar_t *__wcstok_xpg5(wchar_t *_RESTRICT_KYWD, - const wchar_t *_RESTRICT_KYWD, wchar_t **_RESTRICT_KYWD); -extern size_t __wcsftime_xpg5(wchar_t *_RESTRICT_KYWD, size_t, - const wchar_t *_RESTRICT_KYWD, const struct tm *_RESTRICT_KYWD); -#define wcstok __wcstok_xpg5 -#define wcsftime __wcsftime_xpg5 -#endif /* __PRAGMA_REDEFINE_EXTNAME */ -#endif /* XPG4 or XPG4v2 */ -#endif /* !defined(_MSE_INT_H) */ /* not XPG4 and not XPG4v2 */ #if !defined(_XPG4) || defined(_XPG5)
--- a/usr/src/lib/libc/inc/mse_int.h Fri May 03 20:35:27 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _MSE_INT_H -#define _MSE_INT_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stddef.h> -#include <time.h> - -#undef wcsftime -#undef wcstok - -extern size_t wcsftime(wchar_t *, size_t, const char *, const struct tm *); -extern size_t __wcsftime_xpg5(wchar_t *, size_t, const wchar_t *, - const struct tm *); - -extern wchar_t *wcstok(wchar_t *, const wchar_t *); -extern wchar_t *__wcstok_xpg5(wchar_t *, const wchar_t *, wchar_t **); - -#endif /* _MSE_INT_H */
--- a/usr/src/lib/libc/port/i18n/getwchar.c Fri May 03 20:35:27 2019 +0000 +++ b/usr/src/lib/libc/port/i18n/getwchar.c Tue May 07 00:52:58 2019 +0000 @@ -39,7 +39,6 @@ */ #include "lint.h" -#include "mse_int.h" #include <stdio.h> #include <stdlib.h> #include <widec.h>
--- a/usr/src/lib/libc/port/i18n/putwchar.c Fri May 03 20:35:27 2019 +0000 +++ b/usr/src/lib/libc/port/i18n/putwchar.c Tue May 07 00:52:58 2019 +0000 @@ -37,7 +37,6 @@ */ #include "lint.h" -#include "mse_int.h" #include <stdio.h> #include <stdlib.h> #include <widec.h>
--- a/usr/src/lib/libc/port/i18n/wstok.c Fri May 03 20:35:27 2019 +0000 +++ b/usr/src/lib/libc/port/i18n/wstok.c Tue May 07 00:52:58 2019 +0000 @@ -40,7 +40,6 @@ #include "lint.h" #include "mtlib.h" -#include "mse_int.h" #include <stdlib.h> #include <wchar.h> #include <thread.h> @@ -51,8 +50,10 @@ #define WNULL (wchar_t *)0 #endif +#pragma weak __wcstok_xpg5 = wcstok + wchar_t * -__wcstok_xpg5(wchar_t *string, const wchar_t *sepset, wchar_t **ptr) +wcstok(wchar_t *string, const wchar_t *sepset, wchar_t **ptr) { wchar_t *q, *r; @@ -72,18 +73,18 @@ } -wchar_t * -wcstok(wchar_t *string, const wchar_t *sepset) +static wchar_t * +wcstok_xpg4(wchar_t *string, const wchar_t *sepset) { wchar_t **lasts = tsdalloc(_T_WCSTOK, sizeof (wchar_t *), NULL); if (lasts == NULL) return (NULL); - return (__wcstok_xpg5(string, sepset, lasts)); + return (wcstok(string, sepset, lasts)); } wchar_t * wstok(wchar_t *string, const wchar_t *sepset) { - return (wcstok(string, sepset)); + return (wcstok_xpg4(string, sepset)); }
--- a/usr/src/lib/libc/port/locale/fgetwc.c Fri May 03 20:35:27 2019 +0000 +++ b/usr/src/lib/libc/port/locale/fgetwc.c Tue May 07 00:52:58 2019 +0000 @@ -27,7 +27,6 @@ */ #include "lint.h" -#include "mse_int.h" #include "file64.h" #include "mtlib.h" #include <errno.h>
--- a/usr/src/lib/libc/port/locale/fgetws.c Fri May 03 20:35:27 2019 +0000 +++ b/usr/src/lib/libc/port/locale/fgetws.c Tue May 07 00:52:58 2019 +0000 @@ -26,7 +26,6 @@ */ #include "lint.h" -#include "mse_int.h" #include "file64.h" #include <errno.h> #include <stdio.h>
--- a/usr/src/lib/libc/port/locale/fputwc.c Fri May 03 20:35:27 2019 +0000 +++ b/usr/src/lib/libc/port/locale/fputwc.c Tue May 07 00:52:58 2019 +0000 @@ -33,7 +33,6 @@ #include "lint.h" #include "file64.h" #include "mtlib.h" -#include "mse_int.h" #include <errno.h> #include <limits.h> #include <stdio.h>
--- a/usr/src/lib/libc/port/locale/fputws.c Fri May 03 20:35:27 2019 +0000 +++ b/usr/src/lib/libc/port/locale/fputws.c Tue May 07 00:52:58 2019 +0000 @@ -24,7 +24,6 @@ * SUCH DAMAGE. */ #include "lint.h" -#include "mse_int.h" #include "file64.h" #include "mtlib.h" #include <errno.h>
--- a/usr/src/lib/libc/port/locale/fwide.c Fri May 03 20:35:27 2019 +0000 +++ b/usr/src/lib/libc/port/locale/fwide.c Tue May 07 00:52:58 2019 +0000 @@ -26,7 +26,6 @@ */ #include "lint.h" -#include "mse_int.h" #include "file64.h" #include "mse.h" #include <errno.h>
--- a/usr/src/lib/libc/port/locale/ungetwc.c Fri May 03 20:35:27 2019 +0000 +++ b/usr/src/lib/libc/port/locale/ungetwc.c Tue May 07 00:52:58 2019 +0000 @@ -41,7 +41,6 @@ #include "lint.h" #include "file64.h" -#include "mse_int.h" #include <stdio.h> #include <stdlib.h> #include <widec.h>
--- a/usr/src/lib/libc/port/locale/wcsftime.c Fri May 03 20:35:27 2019 +0000 +++ b/usr/src/lib/libc/port/locale/wcsftime.c Tue May 07 00:52:58 2019 +0000 @@ -26,7 +26,6 @@ */ #include "lint.h" -#include "mse_int.h" #include <errno.h> #include <limits.h> #include <stdlib.h> @@ -35,6 +34,8 @@ #include <wchar.h> #include <alloca.h> +#pragma weak __wcsftime_xpg5 = wcsftime + /* * Convert date and time to a wide-character string. * @@ -58,7 +59,7 @@ */ size_t -__wcsftime_xpg5(wchar_t *wcs, size_t maxsize, const wchar_t *format, +wcsftime(wchar_t *wcs, size_t maxsize, const wchar_t *format, const struct tm *timeptr) { static const mbstate_t initial = { 0 }; @@ -117,23 +118,3 @@ errno = sverrno; return (0); } - -size_t -wcsftime(wchar_t *wcs, size_t maxsize, const char *format, - const struct tm *timeptr) -{ - int len; - wchar_t *wfmt; - size_t rv; - - /* Convert the format (mb string) to wide char array */ - len = strlen(format) + 1; - wfmt = malloc(sizeof (wchar_t) * len); - if (mbstowcs(wfmt, format, len) == (size_t)-1) { - free(wfmt); - return (0); - } - rv = __wcsftime_xpg5(wcs, maxsize, wfmt, timeptr); - free(wfmt); - return (rv); -}
--- a/usr/src/lib/libc/port/mapfile-vers Fri May 03 20:35:27 2019 +0000 +++ b/usr/src/lib/libc/port/mapfile-vers Tue May 07 00:52:58 2019 +0000 @@ -3065,8 +3065,8 @@ _uncached_getpwuid_r; _unordered; utssys; - __wcsftime_xpg5; - __wcstok_xpg5; + __wcsftime_xpg5 { FLAGS = NODYNSORT }; + __wcstok_xpg5 { FLAGS = NODYNSORT }; wdbindf; wdchkind; wddelim;