duplocale.c raw

   1  #include <stdlib.h>
   2  #include <string.h>
   3  #include "locale_impl.h"
   4  #include "libc.h"
   5  
   6  #define malloc __libc_malloc
   7  #define calloc undef
   8  #define realloc undef
   9  #define free undef
  10  
  11  locale_t __duplocale(locale_t old)
  12  {
  13  	locale_t new = malloc(sizeof *new);
  14  	if (!new) return 0;
  15  	if (old == LC_GLOBAL_LOCALE) old = &libc.global_locale;
  16  	*new = *old;
  17  	return new;
  18  }
  19  
  20  weak_alias(__duplocale, duplocale);
  21