[uim-commit] r1171 - trunk/uim
yamaken at freedesktop.org
yamaken at freedesktop.org
Tue Aug 9 12:00:28 EST 2005
Author: yamaken
Date: 2005-08-08 19:00:21 -0700 (Mon, 08 Aug 2005)
New Revision: 1171
Modified:
trunk/uim/uim-custom.c
Log:
* uim/uim-custom.c
- (UIM_CUSTOM_EXPERIMENTAL_MTIME_SENSING): New macro
- (file_content_is_same): Enclose by #ifdef
UIM_CUSTOM_EXPERIMENTAL_MTIME_SENSING
- (uim_custom_save_group):
* Enclose the experimental code added in r1164
* Add a comment about the code
Modified: trunk/uim/uim-custom.c
===================================================================
--- trunk/uim/uim-custom.c 2005-08-09 01:34:51 UTC (rev 1170)
+++ trunk/uim/uim-custom.c 2005-08-09 02:00:21 UTC (rev 1171)
@@ -55,6 +55,10 @@
#include "context.h"
#include "uim-helper.h"
+#if 1
+/* TODO: make stable */
+#define UIM_CUSTOM_EXPERIMENTAL_MTIME_SENSING
+#endif
typedef void (*uim_custom_cb_update_cb_t)(void *ptr, const char *custom_sym);
typedef void (*uim_custom_global_cb_update_cb_t)(void *ptr);
@@ -829,7 +833,7 @@
return for_each_primary_groups(uim_custom_load_group);
}
-
+#ifdef UIM_CUSTOM_EXPERIMENTAL_MTIME_SENSING
static uim_bool
file_content_is_same(const char *a_path, const char *b_path)
{
@@ -855,8 +859,8 @@
return UIM_TRUE;
}
+#endif
-
static uim_bool
uim_custom_save_group(const char *group)
{
@@ -896,15 +900,24 @@
if (fclose(file) < 0)
goto error;
+
/* rename prepared temporary file to proper name */
-
file_path = custom_file_path(group, 0);
+#ifdef UIM_CUSTOM_EXPERIMENTAL_MTIME_SENSING
+ /*
+ * Avoiding a file saving at here by such method is a layer
+ * violation. Observing updated group is recommended way.
+ * -- YamaKen 2005-08-09
+ */
if(file_content_is_same(tmp_file_path, file_path)) {
succeeded = UIM_TRUE;
remove(tmp_file_path);
} else {
succeeded = (rename(tmp_file_path, file_path) == 0);
}
+#else
+ succeeded = (rename(tmp_file_path, file_path) == 0);
+#endif
free(file_path);
error:
More information about the uim-commit
mailing list