changeset 533:e62b2e06ab7b

Simplify and optimize extension_find_dot().
author zas_
date Thu, 01 May 2008 18:26:30 +0000
parents ea226ad80fc4
children 0a2b8210ef1d
files src/cache_maint.c
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/cache_maint.c	Tue Apr 29 22:44:06 2008 +0000
+++ b/src/cache_maint.c	Thu May 01 18:26:30 2008 +0000
@@ -68,18 +68,17 @@
 
 static gchar *extension_find_dot(gchar *path)
 {
-	gchar *ptr;
+	gchar *dot = NULL;
 
-	if (!path || *path == '\0') return NULL;
+	if (!path) return NULL;
 
-	ptr = path;
-	while (*ptr != '\0') ptr++;
+	while (*path != '\0')
+		{
+		if (*path == '.') dot = path;
+		path++;
+		}
 
-	while (ptr > path && *ptr != '.') ptr--;
-
-	if (ptr == path) return NULL;
-
-	return ptr;
+	return dot;
 }
 
 static gint isempty(const gchar *path)