aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/locale/mbrtowc.c
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2004-04-04 11:31:29 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2004-04-04 11:31:29 +0000
commit4fb9e805dc7791b3a0b7f760e2c3f23c27ec6269 (patch)
treee55b69186236f3d02d9104179bb76be616d5a4d6 /lib/libc/locale/mbrtowc.c
parent4f6d4aa30de4474cc1ef2671d91991ad3d391ec6 (diff)
Remove support for emulating mbrtowc() and wcrtomb() in terms of the
old rune interface now that it is no longer needed.
Notes
Notes: svn path=/head/; revision=127835
Diffstat (limited to 'lib/libc/locale/mbrtowc.c')
-rw-r--r--lib/libc/locale/mbrtowc.c51
1 files changed, 1 insertions, 50 deletions
diff --git a/lib/libc/locale/mbrtowc.c b/lib/libc/locale/mbrtowc.c
index e99308242a8c..f3b12b43b721 100644
--- a/lib/libc/locale/mbrtowc.c
+++ b/lib/libc/locale/mbrtowc.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2002, 2003 Tim J. Robbins.
+ * Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,9 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <errno.h>
-#include <rune.h>
-#include <stdlib.h>
#include <wchar.h>
extern size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict,
@@ -42,49 +39,3 @@ mbrtowc(wchar_t * __restrict pwc, const char * __restrict s,
return (__mbrtowc(pwc, s, n, ps));
}
-
-/*
- * Emulate the ISO C mbrtowc() function in terms of the deprecated
- * 4.4BSD sgetrune() function.
- */
-size_t
-__emulated_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s,
- size_t n, mbstate_t * __restrict ps __unused)
-{
- const char *e;
- rune_t r;
-
- if (s == NULL) {
- pwc = NULL;
- s = "";
- n = 1;
- }
-
- if ((r = sgetrune(s, n, &e)) == _INVALID_RUNE) {
- /*
- * The design of sgetrune() doesn't give us any way to tell
- * between incomplete and invalid multibyte sequences.
- */
-
- if (n >= (size_t)MB_CUR_MAX) {
- /*
- * If we have been supplied with at least MB_CUR_MAX
- * bytes and still cannot find a valid character, the
- * data must be invalid.
- */
- errno = EILSEQ;
- return ((size_t)-1);
- }
-
- /*
- * .. otherwise, it's an incomplete character or an invalid
- * character we cannot detect yet.
- */
- return ((size_t)-2);
- }
-
- if (pwc != NULL)
- *pwc = (wchar_t)r;
-
- return (r != 0 ? (size_t)(e - s) : 0);
-}