Skip to content

Commit

Permalink
Simplify and optimize extension_find_dot().
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Monin committed May 1, 2008
1 parent e00eb93 commit ac59f99
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/cache_maint.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,17 @@ static gint extension_truncate(gchar *path, const gchar *ext)

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 (ptr > path && *ptr != '.') ptr--;

if (ptr == path) return NULL;
while (*path != '\0')
{
if (*path == '.') dot = path;
path++;
}

return ptr;
return dot;
}

static gint isempty(const gchar *path)
Expand Down

0 comments on commit ac59f99

Please sign in to comment.