diff options
-rw-r--r-- | src/ChangeLog | 4 | ||||
-rw-r--r-- | src/hyper/addfile.c | 16 |
2 files changed, 9 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e69de29b..4e34a158 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -0,0 +1,4 @@ +2010-01-03 Aleksej Saushev <asau@inbox.ru> + + * hyper/addfile.c (strpostfix): Simplify. + 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 */ |