From 9396c233a4b172374120e1a8d1de41a274ee17a4 Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 3 Aug 2007 02:30:45 +0000 Subject: [PATCH] un-crazy-fy current_locale git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1071 9efc2488-bf62-4759-914b-345cdb29e865 --- src/libopensrf/osrf_message.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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"); -- 2.43.2