return;
};
- gchar* tmp = g_utf8_casefold(pattern,-1);
- guint len = strlen(tmp);
-
GArray* result = g_array_new(TRUE, TRUE, sizeof(gchar*) );
guint a = G_MAXUINT32;
DBT search = { &a , sizeof(a) };
DBT reply = { NULL , 0 };
gchar* down_word = NULL;
+
+ GPatternSpec* regex;
+ regex = g_pattern_spec_new (g_utf8_casefold(pattern,-1));
gint code = data->db_words->sync(data->db_words, 0);
code = data->db_words->seq(data->db_words, &search, &reply, R_FIRST);
-
+
+/*
if((('*' == pattern[0]) && ('\0' == pattern[1])) || ('\0' == pattern[0]))
{
// especiall treat if user give only '*'
}
}
else
- {
+ {*/
while(0 == code) {
down_word = g_utf8_casefold((gchar*)(search.data),-1);
- if(search.size > len)
- {
- down_word[len] = '\0';
- };
-
- if( 0 == g_utf8_collate( down_word , tmp ) )
+
+ if( 0 == g_pattern_match_string( regex, down_word ) )
{
gchar* cos = g_strdup(search.data);
g_array_append_val(result, cos );
eg_free(down_word);
code = data->db_words->seq(data->db_words, &search, &reply, R_NEXT);
}
- }
- eg_free(tmp); tmp = NULL;
+
bm_timer(TIMER_STOP,(gchar*)(gchar*)__FUNCTION__);
+ g_pattern_spec_free (regex);
bm_timer(TIMER_START,"callback for returning words LIST START");
}
g_array_free(result, TRUE);
}*/
- len = 0;
+ guint len = 0;
+ gchar *tmp;
+
while(NULL != (tmp = g_array_index(result,gchar*,len++)))
{
g_free(tmp); tmp = NULL;