Print this page
2964 need POSIX 2008 locale object support

@@ -4,10 +4,15 @@
  *      The Regents of the University of California.  All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
  * Paul Borman at Krystal Technologies.
  *
+ * Copyright (c) 2011 The FreeBSD Foundation
+ * All rights reserved.
+ * Portions of this software were developed by David Chisnall
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.

@@ -45,10 +50,15 @@
 #include "mblocal.h"
 #include "setlocale.h"
 #include "_ctype.h"
 #include "../i18n/_locale.h"
 
+/*
+ * A cached version of the runes for this thread.  Used by ctype.h
+ */
+__thread const _RuneLocale *_ThreadRuneLocale;
+
 extern _RuneLocale      *_Read_RuneMagi(FILE *);
 extern unsigned char    __ctype_C[];
 
 static int              __setrunelocale(const char *);
 

@@ -248,5 +258,27 @@
                 errno = ret;
                 return (_LDP_ERROR);
         }
         return (_LDP_LOADED);
 }
+
+void
+__set_thread_rune_locale(locale_t loc)
+{
+
+        if (loc == NULL) {
+                _ThreadRuneLocale = &_DefaultRuneLocale;
+        } else {
+                _ThreadRuneLocale = XLOCALE_CTYPE(loc)->runes;
+        }
+}
+
+void *
+__ctype_load(const char *locale, locale_t unused)
+{
+        struct xlocale_ctype *l;
+
+        l = calloc(sizeof(struct xlocale_ctype), 1);
+        /* XXX */
+
+        return (l);
+}