[Opensrf-commits] r1071 - trunk/src/libopensrf

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Aug 2 22:32:55 EDT 2007


Author: miker
Date: 2007-08-02 22:30:45 -0400 (Thu, 02 Aug 2007)
New Revision: 1071

Modified:
   trunk/src/libopensrf/osrf_message.c
Log:
un-crazy-fy current_locale

Modified: trunk/src/libopensrf/osrf_message.c
===================================================================
--- trunk/src/libopensrf/osrf_message.c	2007-08-03 02:20:56 UTC (rev 1070)
+++ trunk/src/libopensrf/osrf_message.c	2007-08-03 02:30:45 UTC (rev 1071)
@@ -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,11 +286,15 @@
 
 			/* use the sender's locale, or the global default */
 			tmp = jsonObjectGetKey(message, "locale");
-			if(tmp)
+			if(tmp) {
 				new_msg->sender_locale = jsonObjectToSimpleString(tmp);
+				if (current_locale)
+					free( current_locale );
+				current_locale = strdup( new_msg->sender_locale );
+			} else {
+				current_locale = NULL;
+			}
 
-			current_locale = new_msg->sender_locale;
-
 			tmp = jsonObjectGetKey(message, "protocol");
 
 			if(tmp) {



More information about the opensrf-commits mailing list