Mercurial > geeqie
comparison src/cache_maint.c @ 533:e62b2e06ab7b
Simplify and optimize extension_find_dot().
author | zas_ |
---|---|
date | Thu, 01 May 2008 18:26:30 +0000 |
parents | b7e99bfeadc9 |
children | 9dc0513837b5 |
comparison
equal
deleted
inserted
replaced
532:ea226ad80fc4 | 533:e62b2e06ab7b |
---|---|
66 return TRUE; | 66 return TRUE; |
67 } | 67 } |
68 | 68 |
69 static gchar *extension_find_dot(gchar *path) | 69 static gchar *extension_find_dot(gchar *path) |
70 { | 70 { |
71 gchar *ptr; | 71 gchar *dot = NULL; |
72 | 72 |
73 if (!path || *path == '\0') return NULL; | 73 if (!path) return NULL; |
74 | 74 |
75 ptr = path; | 75 while (*path != '\0') |
76 while (*ptr != '\0') ptr++; | 76 { |
77 | 77 if (*path == '.') dot = path; |
78 while (ptr > path && *ptr != '.') ptr--; | 78 path++; |
79 | 79 } |
80 if (ptr == path) return NULL; | 80 |
81 | 81 return dot; |
82 return ptr; | |
83 } | 82 } |
84 | 83 |
85 static gint isempty(const gchar *path) | 84 static gint isempty(const gchar *path) |
86 { | 85 { |
87 DIR *dp; | 86 DIR *dp; |