aboutsummaryrefslogtreecommitdiff
path: root/src/hyper
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-01-03 22:02:24 +0000
committerdos-reis <gdr@axiomatics.org>2010-01-03 22:02:24 +0000
commit18fe2f66766b2c30614cd5c28681fddf2c0f3ac8 (patch)
treec932f8aebc391d3ece46304e56bbbeb149666ed8 /src/hyper
parentb65aaf7804179f9b9c0fbae3b76e211a1692744d (diff)
downloadopen-axiom-18fe2f66766b2c30614cd5c28681fddf2c0f3ac8.tar.gz
2010-01-03 Aleksej Saushev <asau@inbox.ru>
* hyper/addfile.c (strpostfix): Simplify.
Diffstat (limited to 'src/hyper')
-rw-r--r--src/hyper/addfile.c16
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 */