OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libpthread/] [linuxthreads/] [locale.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/*  Copyright (C) 2003     Manuel Novoa III
2
 *
3
 *  This library is free software; you can redistribute it and/or
4
 *  modify it under the terms of the GNU Library General Public
5
 *  License as published by the Free Software Foundation; either
6
 *  version 2 of the License, or (at your option) any later version.
7
 *
8
 *  This library is distributed in the hope that it will be useful,
9
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
 *  Library General Public License for more details.
12
 *
13
 *  You should have received a copy of the GNU Library General Public
14
 *  License along with this library; if not, write to the Free
15
 *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16
 */
17
 
18
#define _GNU_SOURCE
19
#include <features.h>
20
#include "pthread.h"
21
#include "internals.h"
22
#include <locale.h>
23
#include <assert.h>
24
#include <stdlib.h>
25
 
26
extern struct _pthread_descr_struct __pthread_initial_thread;
27
 
28
__locale_t __curlocale(void)
29
{
30
        pthread_descr self = thread_self();
31
 
32
#ifdef NDEBUG
33
        return THREAD_GETMEM (self, locale);
34
#else
35
        {
36
                __locale_t r = THREAD_GETMEM (self, locale);
37
 
38
                assert(r);
39
 
40
                return r;
41
        }
42
#endif
43
}
44
 
45
__locale_t __curlocale_set(__locale_t newloc)
46
{
47
        __locale_t oldloc;
48
        pthread_descr self = thread_self();
49
 
50
        oldloc = THREAD_GETMEM (self, locale);
51
 
52
        assert(newloc != LC_GLOBAL_LOCALE);
53
        assert(oldloc);
54
 
55
        THREAD_SETMEM (self, locale, newloc);
56
 
57
        return oldloc;
58
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.