Restore the original ascii.c from prior to r290494

It was doing the right thing, there was no need to "fail" to reinvent it from
none.c

Pointy hat:	bapt
Submitted by:	ache
This commit is contained in:
Baptiste Daroussin 2016-04-21 07:36:11 +00:00
parent 84d1adbb17
commit 49c4407313
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298396

View File

@ -1,6 +1,4 @@
/*
* Copyright 2013 Garrett D'Amore <garrett@damore.org>
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
/*-
* Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@ -36,8 +34,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)none.c 8.1 (Berkeley) 6/4/93
*/
#include <sys/cdefs.h>
@ -65,7 +61,7 @@ static size_t _ascii_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
size_t, size_t, mbstate_t * __restrict);
int
_ascii_init(struct xlocale_ctype *l, _RuneLocale *rl)
_ascii_init(struct xlocale_ctype *l,_RuneLocale *rl)
{
l->__mbrtowc = _ascii_mbrtowc;
@ -82,6 +78,7 @@ _ascii_init(struct xlocale_ctype *l, _RuneLocale *rl)
static int
_ascii_mbsinit(const mbstate_t *ps __unused)
{
/*
* Encoding is not state dependent - we are always in the
* initial state.
@ -93,6 +90,7 @@ static size_t
_ascii_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
mbstate_t * __restrict ps __unused)
{
if (s == NULL)
/* Reset to initial shift state (no-op) */
return (0);
@ -132,13 +130,11 @@ _ascii_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
size_t nchr;
if (dst == NULL) {
s = memchr(*src, '\0', nms);
if (s == NULL)
return (nms);
if (*s & 0x80) {
errno = EILSEQ;
return ((size_t)-1);
for (s = *src; nms > 0 && *s != '\0'; s++, nms--) {
if (*s & 0x80) {
errno = EILSEQ;
return ((size_t)-1);
}
}
return (s - *src);
}
@ -193,3 +189,4 @@ _ascii_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
*src = s;
return (nchr);
}