summaryrefslogtreecommitdiff
path: root/usr/src/lib/libc/port/stdio/mse.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@nexenta.com>2010-07-30 07:06:32 -0700
committerGarrett D'Amore <garrett@nexenta.com>2010-07-30 07:06:32 -0700
commit4297a3b0d0a35d80f86fff155e288e885a100e6d (patch)
treebba873e6335d31404bbac128ffa6ebe126b43900 /usr/src/lib/libc/port/stdio/mse.c
parent969bc941052c29943dfb40d55089dc56fa46be57 (diff)
downloadillumos-gate-4297a3b0d0a35d80f86fff155e288e885a100e6d.tar.gz
2 We need a fully open libc (no libc_i18n)
Reviewd by: garrett@nexenta.com Approved by: garrett@nexenta.com
Diffstat (limited to 'usr/src/lib/libc/port/stdio/mse.c')
-rw-r--r--usr/src/lib/libc/port/stdio/mse.c149
1 files changed, 4 insertions, 145 deletions
diff --git a/usr/src/lib/libc/port/stdio/mse.c b/usr/src/lib/libc/port/stdio/mse.c
index 4d5ee6874a..2b50dfbc69 100644
--- a/usr/src/lib/libc/port/stdio/mse.c
+++ b/usr/src/lib/libc/port/stdio/mse.c
@@ -24,7 +24,10 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
#include "lint.h"
#include "mtlib.h"
@@ -43,21 +46,6 @@
/*
* DESCRIPTION:
- * This function sets the error indicator for the specified stream.
- * This is a private API for the L10N method functions, especially
- * for fgetwc().
- *
- * The stream needs to have been properly locked. Usually, the wrapper
- * function of fgetwc() locks the stream.
- */
-void
-__fseterror_u(FILE *iop)
-{
- iop->_flag |= _IOERR;
-}
-
-/*
- * DESCRIPTION:
* This function/macro gets the orientation bound to the specified iop.
*
* RETURNS:
@@ -104,132 +92,3 @@ _setorientation(FILE *iop, _IOP_orientation_t mode)
break;
}
}
-
-static mbstate_t **__top_mbstates = NULL;
-static mutex_t __top_mbstates_lock = DEFAULTMUTEX;
-
-void
-_clear_internal_mbstate(void)
-{
- int i;
-
- lmutex_lock(&__top_mbstates_lock);
- if (__top_mbstates) {
- for (i = 0; i <= _MAX_MB_FUNC; i++) {
- if (*(__top_mbstates + i)) {
- lfree(*(__top_mbstates + i),
- sizeof (mbstate_t));
- }
- }
- lfree(__top_mbstates,
- (_MAX_MB_FUNC + 1) * sizeof (mbstate_t *));
- __top_mbstates = NULL;
- }
- lmutex_unlock(&__top_mbstates_lock);
-}
-
-mbstate_t *
-_get_internal_mbstate(int item)
-{
- if (item < 0 || item > _MAX_MB_FUNC)
- return (NULL);
-
- lmutex_lock(&__top_mbstates_lock);
- if (__top_mbstates == NULL) {
- __top_mbstates =
- lmalloc((_MAX_MB_FUNC + 1) * sizeof (mbstate_t *));
- if (__top_mbstates == NULL) {
- lmutex_unlock(&__top_mbstates_lock);
- return (NULL);
- }
- *(__top_mbstates + item) = lmalloc(sizeof (mbstate_t));
- if (*(__top_mbstates + item) == NULL) {
- lmutex_unlock(&__top_mbstates_lock);
- return (NULL);
- }
- lmutex_unlock(&__top_mbstates_lock);
- return (*(__top_mbstates + item));
- }
- if (*(__top_mbstates + item) == NULL) {
- *(__top_mbstates + item) = lmalloc(sizeof (mbstate_t));
- if (*(__top_mbstates + item) == NULL) {
- lmutex_unlock(&__top_mbstates_lock);
- return (NULL);
- }
- }
- lmutex_unlock(&__top_mbstates_lock);
- return (*(__top_mbstates + item));
-}
-
-/*
- * From page 32 of XSH5
- * Once a wide-character I/O function has been applied
- * to a stream without orientation, the stream becomes
- * wide-orientated. Similarly, once a byte I/O function
- * has been applied to a stream without orientation,
- * the stream becomes byte-orientated. Only a call to
- * the freopen() function or the fwide() function can
- * otherwise alter the orientation of a stream.
- */
-
-/*
- * void
- * _set_orientation_byte(FILE *iop)
- *
- * Note: this is now implemented as macro __SET_ORIENTATION_BYTE()
- * (in libc/inc/mse.h) for performance improvement.
- */
-
-/* Returns the value of 'ps->__nconsumed' */
-char
-__mbst_get_nconsumed(const mbstate_t *ps)
-{
- return (ps->__nconsumed);
-}
-
-/* Sets 'n' to 'ps->__nconsumed' */
-void
-__mbst_set_nconsumed(mbstate_t *ps, char n)
-{
- ps->__nconsumed = n;
-}
-
-/* Copies 'len' bytes from '&ps->__consumed[index]' to 'str' */
-int
-__mbst_get_consumed_array(const mbstate_t *ps, char *str,
- size_t index, size_t len)
-{
- if ((index + len) > 8) {
- /* The max size of __consumed[] is 8 */
- return (-1);
- }
- (void) memcpy((void *)str, (const void *)&ps->__consumed[index], len);
- return (0);
-}
-
-/* Copies 'len' bytes from 'str' to '&ps->__consumed[index]' */
-int
-__mbst_set_consumed_array(mbstate_t *ps, const char *str,
- size_t index, size_t len)
-{
- if ((index + len) > 8) {
- /* The max size of __consumed[] is 8 */
- return (-1);
- }
- (void) memcpy((void *)&ps->__consumed[index], (const void *)str, len);
- return (0);
-}
-
-/* Returns 'ps->__lc_locale' */
-void *
-__mbst_get_locale(const mbstate_t *ps)
-{
- return (ps->__lc_locale);
-}
-
-/* Sets 'loc' to 'ps->__lc_locale' */
-void
-__mbst_set_locale(mbstate_t *ps, const void *loc)
-{
- ps->__lc_locale = (void *)loc;
-}