diff options
Diffstat (limited to 'src/hyper/addfile.c')
-rw-r--r-- | src/hyper/addfile.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/hyper/addfile.c b/src/hyper/addfile.c index 7fcbeae3..1e6c6b9b 100644 --- a/src/hyper/addfile.c +++ b/src/hyper/addfile.c @@ -50,22 +50,16 @@ static int build_ht_filename(char*, char*, char*); static int pathname(char*); -static int strpostfix(char*, char*); - char *gDatabasePath = NULL; +/* Return non-zero if the string T is a postfix of S. */ static int -strpostfix(char *s, char *t) +strpostfix(const char *s, const char *t) { - int slen = strlen(s), tlen = strlen(t); - - if (tlen > slen) - return 0; - while (tlen > 0) - if (s[--slen] != t[--tlen]) - return 0; - return 1; + const int slen = strlen(s); + const int tlen = strlen(t); + return tlen <= slen && strcmp(s + slen - tlen, t) == 0; } /* extend_ht : just checks the name and adds a .ht if needed */ |