svnno****@sourc*****
svnno****@sourc*****
Fri Mar 23 11:45:11 JST 2007
Revision: 2971 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=2971 Author: kous Date: 2007-03-23 11:45:11 +0900 (Fri, 23 Mar 2007) Log Message: ----------- * src/actions/kz-history-action.c: moved PCRE workaround to ... * src/kz-migemo.c: ... here. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/src/actions/kz-history-action.c kazehakase/trunk/src/kz-migemo.c Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2007-03-23 02:42:25 UTC (rev 2970) +++ kazehakase/trunk/ChangeLog 2007-03-23 02:45:11 UTC (rev 2971) @@ -1,3 +1,8 @@ +2007-03-23 Kouhei Sutou <kou****@cozmi*****> + + * src/actions/kz-history-action.c: moved PCRE workaround to ... + * src/kz-migemo.c: ... here. + 2007-03-23 Hiroyuki Ikezoe <poinc****@ikezo*****> * src/prefs_ui/prefs_privacy.c: Use KZ_CONF_SET instead of Modified: kazehakase/trunk/src/actions/kz-history-action.c =================================================================== --- kazehakase/trunk/src/actions/kz-history-action.c 2007-03-23 02:42:25 UTC (rev 2970) +++ kazehakase/trunk/src/actions/kz-history-action.c 2007-03-23 02:45:11 UTC (rev 2971) @@ -25,9 +25,6 @@ #include <string.h> #include <glib/gi18n.h> -/* PCRE causes segfault if a big regex is passed. X< */ -#define MAX_REGEX_LENGTH 4096 - enum { HISTORY_CHANGED_SIGNAL, LAST_SIGNAL @@ -314,13 +311,8 @@ KZ_CONF_GET("Global", "use_migemo", use_migemo, BOOL); if (use_migemo) regex = kz_migemo_get_regex(KZ_GET_MIGEMO, key); - if (regex && strlen(regex) >= MAX_REGEX_LENGTH) - { - g_free(regex); - regex = NULL; - } #endif /* USE_MIGEMO */ - if (!regex && strlen(key) < MAX_REGEX_LENGTH) + if (!regex) regex = g_strdup(key); } Modified: kazehakase/trunk/src/kz-migemo.c =================================================================== --- kazehakase/trunk/src/kz-migemo.c 2007-03-23 02:42:25 UTC (rev 2970) +++ kazehakase/trunk/src/kz-migemo.c 2007-03-23 02:45:11 UTC (rev 2971) @@ -37,6 +37,9 @@ #define MIGEMO_MAX_LENGTH 64 #define MIGEMO_DEFAULT_COMMAND "migemo -t perl -d /usr/share/migemo/migemo-dict" +/* PCRE causes segfault if a big regex is passed. X< */ +#define MIGEMO_MAX_REGEX_LENGTH 4096 + KzMigemo * kz_migemo_new (void) { @@ -158,6 +161,12 @@ NULL, NULL, NULL); g_free(read_buf); + if (regex && strlen(regex) >= MIGEMO_MAX_REGEX_LENGTH) + { + g_free(regex); + regex = g_strdup(text); + } + return regex; } @@ -180,7 +189,7 @@ if (!regex_string) return NULL; regex = g_regex_new(regex_string, - G_REGEX_CASELESS | + G_REGEX_CASELESS | G_REGEX_MULTILINE | G_REGEX_EXTENDED, 0, &e);