Print this page
Thread safety fixes.

@@ -1,7 +1,7 @@
 /*
- * Copyright 2013 Garrett D'Amore <garrett@damore.org>
+ * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  * Copyright 2010 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2002-2004 Tim J. Robbins.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

@@ -34,17 +34,15 @@
 #include "mblocal.h"
 
 int
 wctomb_l(char *s, wchar_t wchar, locale_t loc)
 {
-        static const mbstate_t initial = { 0 };
-        static mbstate_t mbs;
+        mbstate_t mbs = { 0 };
         size_t rval;
 
         if (s == NULL) {
                 /* No support for state dependent encodings. */
-                mbs = initial;
                 return (0);
         }
         if ((rval = wcrtomb_l(s, wchar, &mbs, loc)) == (size_t)-1)
                 return (-1);
         return ((int)rval);