gluon-web: remove lmo_canon_hash()

Our strings can be looked up verbatim.
This commit is contained in:
Matthias Schiffer 2018-02-22 13:58:20 +01:00
parent b5817f5523
commit 9e8a6ec2b5
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -69,34 +69,6 @@ static uint32_t sfh_hash(const char *data, int len)
return hash;
}
static uint32_t lmo_canon_hash(const char *str, int len)
{
char res[4096];
char *ptr, prev;
int off;
if (!str || len >= sizeof(res))
return 0;
for (prev = ' ', ptr = res, off = 0; off < len; prev = *str, off++, str++)
{
if (isspace(*str))
{
if (!isspace(prev))
*ptr++ = ' ';
}
else
{
*ptr++ = *str;
}
}
if ((ptr > res) && isspace(*(ptr-1)))
ptr--;
return sfh_hash(res, ptr - res);
}
static lmo_archive_t * lmo_open(const char *file)
{
int in = -1;
@ -272,7 +244,7 @@ int lmo_translate(const char *key, int keylen, char **out, int *outlen)
if (!key || !_lmo_active_catalog)
return -2;
hash = lmo_canon_hash(key, keylen);
hash = sfh_hash(key, keylen);
for (ar = _lmo_active_catalog->archives; ar; ar = ar->next)
{