aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/locale/uselocale.c
blob: dbf0d33936383169c2083486d998be92aafb647d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <newlib.h>
#include <reent.h>
#include <stdlib.h>
#include "setlocale.h"

struct __locale_t *
_uselocale_r (struct _reent *p, struct __locale_t *newloc)
{
  struct __locale_t *current_locale;

  current_locale = __get_locale_r (p);
  if (!current_locale)
    current_locale = LC_GLOBAL_LOCALE;
  if (newloc == LC_GLOBAL_LOCALE)
    p->_locale = NULL;
  else if (newloc)
    p->_locale = newloc;
  return current_locale;
}

#ifndef _REENT_ONLY
struct __locale_t *
uselocale (struct __locale_t *newloc)
{
  return _uselocale_r (_REENT, newloc);
}
#endif