diff options
author | dos-reis <gdr@axiomatics.org> | 2010-01-03 22:02:24 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-01-03 22:02:24 +0000 |
commit | 18fe2f66766b2c30614cd5c28681fddf2c0f3ac8 (patch) | |
tree | c932f8aebc391d3ece46304e56bbbeb149666ed8 /src | |
parent | b65aaf7804179f9b9c0fbae3b76e211a1692744d (diff) | |
download | open-axiom-18fe2f66766b2c30614cd5c28681fddf2c0f3ac8.tar.gz |
2010-01-03 Aleksej Saushev <asau@inbox.ru>
* hyper/addfile.c (strpostfix): Simplify.
Diffstat (limited to 'src')
-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 */ |