aboutsummaryrefslogtreecommitdiff
path: root/src/textadept.c
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-07-09 18:07:14 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2009-07-09 18:07:14 -0400
commit691897246209070d8faa01a2045914ab9a5a6ec6 (patch)
tree595fa3b43e8515cf7c5cde4eeae010c33b664650 /src/textadept.c
parentda54e6a215b387767e1e3ea3b8deadfd79d4e3d3 (diff)
downloadtextadept-691897246209070d8faa01a2045914ab9a5a6ec6.tar.gz
textadept-691897246209070d8faa01a2045914ab9a5a6ec6.zip
Code cleanup and fix memory leaks.
Diffstat (limited to 'src/textadept.c')
-rw-r--r--src/textadept.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/textadept.c b/src/textadept.c
index 00ed9a44..dafb6549 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -644,12 +644,18 @@ static int pm_search_equal_func(GtkTreeModel *model, int col, const char *key,
*/
static int pm_sort_iter_compare_func(GtkTreeModel *model, GtkTreeIter *a,
GtkTreeIter *b, gpointer) {
- char *a_text, *b_text, *p;
+ char *a_text, *b_text;
gtk_tree_model_get(model, a, 1, &a_text, -1);
gtk_tree_model_get(model, b, 1, &b_text, -1);
- if (a_text) for (p = a_text; *p != '\0'; p++) *p = g_ascii_tolower(*p);
- if (b_text) for (p = b_text; *p != '\0'; p++) *p = g_ascii_tolower(*p);
- int retval = g_strcmp0(a_text, b_text);
+ int retval;
+ if (a_text == NULL && b_text == NULL)
+ retval = 0;
+ else if (a_text == NULL)
+ retval = -1;
+ else if (b_text == NULL)
+ retval = 1;
+ else
+ retval = strcasecmp(a_text, b_text);
g_free(a_text);
g_free(b_text);
return retval;