diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2022-01-19 00:45:43 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-04-27 14:08:46 +0200 |
commit | 4875a15ca61358a1c95b156b2279fce092451278 (patch) | |
tree | 79054df1730d4723658b02cec311bc8ba7655662 /nx-X11/lib/src/xlibi18n/lcConv.c | |
parent | a502149a844736dcc7f7dedd7c63229c74a448ee (diff) | |
download | nx-libs-4875a15ca61358a1c95b156b2279fce092451278.tar.gz nx-libs-4875a15ca61358a1c95b156b2279fce092451278.tar.bz2 nx-libs-4875a15ca61358a1c95b156b2279fce092451278.zip |
Update libNX_X11 to upstream's libX11-1.7.3.1-10-gd60ede78
Diffstat (limited to 'nx-X11/lib/src/xlibi18n/lcConv.c')
-rw-r--r-- | nx-X11/lib/src/xlibi18n/lcConv.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/nx-X11/lib/src/xlibi18n/lcConv.c b/nx-X11/lib/src/xlibi18n/lcConv.c index 7d9a4738c..32699746d 100644 --- a/nx-X11/lib/src/xlibi18n/lcConv.c +++ b/nx-X11/lib/src/xlibi18n/lcConv.c @@ -29,6 +29,11 @@ #include "Xlibint.h" #include "XlcPubI.h" #include <stdio.h> +#include "locking.h" + +#ifdef XTHREADS +LockInfoPtr _conv_lock; +#endif typedef struct _XlcConverterListRec { XLCd from_lcd; @@ -58,6 +63,9 @@ get_converter( XrmQuark to_type) { XlcConverterList list, prev = NULL; + XlcConv conv = NULL; + + _XLockMutex(_conv_lock); for (list = conv_list; list; list = list->next) { if (list->from_lcd == from_lcd && list->to_lcd == to_lcd @@ -69,13 +77,16 @@ get_converter( conv_list = list; } - return (*list->converter)(from_lcd, list->from, to_lcd, list->to); + conv = (*list->converter)(from_lcd, list->from, to_lcd, list->to); + break; } prev = list; } - return (XlcConv) NULL; + _XUnlockMutex(_conv_lock); + + return conv; } Bool @@ -92,18 +103,20 @@ _XlcSetConverter( from_type = XrmStringToQuark(from); to_type = XrmStringToQuark(to); + _XLockMutex(_conv_lock); + for (list = conv_list; list; list = list->next) { if (list->from_lcd == from_lcd && list->to_lcd == to_lcd && list->from_type == from_type && list->to_type == to_type) { list->converter = converter; - return True; + goto ret; } } list = Xmalloc(sizeof(XlcConverterListRec)); if (list == NULL) - return False; + goto ret; list->from_lcd = from_lcd; list->from = from; @@ -115,7 +128,9 @@ _XlcSetConverter( list->next = conv_list; conv_list = list; - return True; +ret: + _XUnlockMutex(_conv_lock); + return list != NULL; } typedef struct _ConvRec { |