un-crazy-fy current_locale
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 3 Aug 2007 02:30:45 +0000 (02:30 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 3 Aug 2007 02:30:45 +0000 (02:30 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1071 9efc2488-bf62-4759-914b-345cdb29e865

src/libopensrf/osrf_message.c

index 57d2bd5..220a29c 100644 (file)
@@ -1,7 +1,7 @@
 #include <opensrf/osrf_message.h>
 
 static char default_locale[17] = "en-US\0\0\0\0\0\0\0\0\0\0\0\0";
-static char* current_locale = default_locale;
+static char* current_locale = NULL;
 
 osrf_message* osrf_message_init( enum M_TYPE type, int thread_trace, int protocol ) {
 
@@ -286,10 +286,14 @@ int osrf_message_deserialize(char* string, osrf_message* msgs[], int count) {
 
                        /* use the sender's locale, or the global default */
                        tmp = jsonObjectGetKey(message, "locale");
-                       if(tmp)
+                       if(tmp) {
                                new_msg->sender_locale = jsonObjectToSimpleString(tmp);
-
-                       current_locale = new_msg->sender_locale;
+                               if (current_locale)
+                                       free( current_locale );
+                               current_locale = strdup( new_msg->sender_locale );
+                       } else {
+                               current_locale = NULL;
+                       }
 
                        tmp = jsonObjectGetKey(message, "protocol");