changeset 215:f2b439c7f973

Move strlen() calls outside the while loop.
author zas_
date Sun, 30 Mar 2008 19:26:35 +0000
parents c0e9aac4c7bf
children a57b153e7fa4
files src/filelist.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/filelist.c	Sun Mar 30 14:19:34 2008 +0000
+++ b/src/filelist.c	Sun Mar 30 19:26:35 2008 +0000
@@ -313,14 +313,17 @@
 gint filter_name_exists(const gchar *name)
 {
 	GList *work;
+	gint ln;
+
 	if (!extension_list || file_filter_disable) return TRUE;
 
+	ln = strlen(name);
 	work = extension_list;
 	while (work)
 		{
 		gchar *filter = work->data;
 		gint lf = strlen(filter);
-		gint ln = strlen(name);
+
 		if (ln >= lf)
 			{
 			if (strncasecmp(name + ln - lf, filter, lf) == 0) return TRUE;
@@ -334,6 +337,7 @@
 gint filter_file_class(const gchar *name, FileFormatClass file_class)
 {
 	GList *work;
+	gint ln;
 
 	if (file_class < 0 || file_class >= FILE_FORMAT_CLASSES)
 		{
@@ -341,12 +345,13 @@
 		return FALSE;
 		}
 
+	ln = strlen(name);
 	work = file_class_extension_list[file_class];
 	while (work)
 		{
 		gchar *filter = work->data;
 		gint lf = strlen(filter);
-		gint ln = strlen(name);
+
 		if (ln >= lf)
 			{
 			if (strncasecmp(name + ln - lf, filter, lf) == 0) return TRUE;