From: miker Date: Fri, 3 Aug 2007 02:30:45 +0000 (+0000) Subject: un-crazy-fy current_locale X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9396c233a4b172374120e1a8d1de41a274ee17a4;p=opensrf%2Fbjwebb.git un-crazy-fy current_locale git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1071 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/libopensrf/osrf_message.c b/src/libopensrf/osrf_message.c index 57d2bd5..220a29c 100644 --- a/src/libopensrf/osrf_message.c +++ b/src/libopensrf/osrf_message.c @@ -1,7 +1,7 @@ #include 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");