[uim-commit] r1484 - trunk/uim
yamaken at freedesktop.org
yamaken at freedesktop.org
Mon Sep 12 08:30:32 PDT 2005
Author: yamaken
Date: 2005-09-12 08:30:29 -0700 (Mon, 12 Sep 2005)
New Revision: 1484
Modified:
trunk/uim/context.h
trunk/uim/uim.c
Log:
* This commit performs renaming only
* uim/context.h
- (UIM_NEW_MUTEX, UIM_NEW_MUTEX_STATIC): Rename to UIM_DEFINE_MUTEX*
since the word 'NEW' may cause confusion about the functionality
as if the mutex will be allocated on a heap
- (UIM_DEFINE_MUTEX): Renamed from UIM_NEW_MUTEX
- (UIM_DEFINE_MUTEX_STATIC): Renamed from UIM_NEW_MUTEX_STATIC
* uim/uim.c
- Rename mutexes since:
* Name of mutexes should be consistent with each other
* They should have 'mtx' in their name, but prefixing is YamaKen's
way. If you prefer siffixing, please rename it again
- (initing_or_quiting): Rename to mtx_initing_or_quiting
- (mtx_initing_or_quiting): Renamed from initing_or_quiting
- (context_array_mtx): Rename to mtx_context_array
- (mtx_context_array): Renamed from context_array_mtx
- Follow the ranaming of UIM_NEW_MUTEX_STATIC
- (get_context_id, put_context_id, uim_find_context, uim_init,
uim_quit): Follow the renaming of mutexes
Modified: trunk/uim/context.h
===================================================================
--- trunk/uim/context.h 2005-09-12 14:53:31 UTC (rev 1483)
+++ trunk/uim/context.h 2005-09-12 15:30:29 UTC (rev 1484)
@@ -122,8 +122,10 @@
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
- #define UIM_NEW_MUTEX(mtx) pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
- #define UIM_NEW_MUTEX_STATIC(mtx) static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
+ #define UIM_DEFINE_MUTEX(mtx) \
+ pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
+ #define UIM_DEFINE_MUTEX_STATIC(mtx) \
+ static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
#define UIM_LOCK_MUTEX(mtx) pthread_mutex_lock(&mtx)
#define UIM_UNLOCK_MUTEX(mtx) pthread_mutex_unlock(&mtx)
#else
Modified: trunk/uim/uim.c
===================================================================
--- trunk/uim/uim.c 2005-09-12 14:53:31 UTC (rev 1483)
+++ trunk/uim/uim.c 2005-09-12 15:30:29 UTC (rev 1484)
@@ -62,8 +62,8 @@
static int uim_quiting;
/* Definition of mutex */
-UIM_NEW_MUTEX_STATIC(initing_or_quiting);
-UIM_NEW_MUTEX_STATIC(context_array_mtx);
+UIM_DEFINE_MUTEX_STATIC(mtx_initing_or_quiting);
+UIM_DEFINE_MUTEX_STATIC(mtx_context_array);
void
uim_set_preedit_cb(uim_context uc,
@@ -82,25 +82,25 @@
get_context_id(uim_context uc)
{
int i;
- UIM_LOCK_MUTEX(context_array_mtx);
+ UIM_LOCK_MUTEX(mtx_context_array);
for (i = 0; i < CONTEXT_ARRAY_SIZE; i++) {
if (!context_array[i]) {
context_array[i] = uc;
uc->id = i;
- UIM_UNLOCK_MUTEX(context_array_mtx);
+ UIM_UNLOCK_MUTEX(mtx_context_array);
return;
}
}
uc->id = -1;
- UIM_UNLOCK_MUTEX(context_array_mtx);
+ UIM_UNLOCK_MUTEX(mtx_context_array);
}
static void
put_context_id(uim_context uc)
{
- UIM_LOCK_MUTEX(context_array_mtx);
+ UIM_LOCK_MUTEX(mtx_context_array);
context_array[uc->id] = NULL;
- UIM_UNLOCK_MUTEX(context_array_mtx);
+ UIM_UNLOCK_MUTEX(mtx_context_array);
}
uim_context
@@ -280,9 +280,9 @@
uim_find_context(int id)
{
uim_context uc;
- UIM_LOCK_MUTEX(context_array_mtx);
+ UIM_LOCK_MUTEX(mtx_context_array);
uc = context_array[id];
- UIM_UNLOCK_MUTEX(context_array_mtx);
+ UIM_UNLOCK_MUTEX(mtx_context_array);
return uc;
}
@@ -686,10 +686,10 @@
int
uim_init(void)
{
- UIM_LOCK_MUTEX(initing_or_quiting);
+ UIM_LOCK_MUTEX(mtx_initing_or_quiting);
if (uim_initialized) {
- UIM_UNLOCK_MUTEX(initing_or_quiting);
+ UIM_UNLOCK_MUTEX(mtx_initing_or_quiting);
return 0;
}
uim_last_client_encoding = NULL;
@@ -698,7 +698,7 @@
uim_init_scm();
uim_initialized = 1;
- UIM_UNLOCK_MUTEX(initing_or_quiting);
+ UIM_UNLOCK_MUTEX(mtx_initing_or_quiting);
return 0;
}
@@ -707,10 +707,10 @@
{
int i;
- UIM_LOCK_MUTEX(initing_or_quiting);
+ UIM_LOCK_MUTEX(mtx_initing_or_quiting);
if (!uim_initialized || uim_quiting) {
- UIM_UNLOCK_MUTEX(initing_or_quiting);
+ UIM_UNLOCK_MUTEX(mtx_initing_or_quiting);
return;
}
/* Some multithreaded applications calls uim_quit bursty. */
@@ -729,5 +729,5 @@
uim_last_client_encoding = NULL;
uim_initialized = 0;
uim_quiting = 0;
- UIM_UNLOCK_MUTEX(initing_or_quiting);
+ UIM_UNLOCK_MUTEX(mtx_initing_or_quiting);
}
More information about the uim-commit
mailing list