mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
Use case-sensitive hashing for dedup and translation hash tables.
This commit is contained in:
@@ -35,7 +35,7 @@ static unsigned int DedupeHashFunc(void *x)
|
||||
if (e->trigger_time != NO_TIME) {
|
||||
hashval += (unsigned int) e->trigger_time;
|
||||
}
|
||||
hashval += HashVal(e->body);
|
||||
hashval += HashVal_preservecase(e->body);
|
||||
return hashval;
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,8 @@ int DoPreserve (Parser *p);
|
||||
int DoSatRemind (Trigger *trig, TimeTrig *tt, ParsePtr p);
|
||||
int DoMsgCommand (char const *cmd, char const *msg, int is_queued);
|
||||
int ParseNonSpaceChar (ParsePtr p, int *err, int peek);
|
||||
unsigned int HashVal (char const *str);
|
||||
unsigned int HashVal_ignorecase(char const *str);
|
||||
unsigned int HashVal_preservecase(char const *str);
|
||||
int DateOK (int y, int m, int d);
|
||||
BuiltinFunc *FindBuiltinFunc (char const *name);
|
||||
int InsertIntoSortBuffer (int dse, int tim, char const *body, int typ, int prio);
|
||||
|
||||
@@ -154,7 +154,7 @@ static unsigned int
|
||||
HashXlateItem(void *x)
|
||||
{
|
||||
XlateItem *item = (XlateItem *) x;
|
||||
return HashVal(item->orig);
|
||||
return HashVal_preservecase(item->orig);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -35,12 +35,11 @@ static void DestroyUserFunc (UserFunc *f);
|
||||
static void FUnset (char const *name);
|
||||
static void FSet (UserFunc *f);
|
||||
static void RenameUserFunc(char const *oldname, char const *newname);
|
||||
unsigned int HashVal_nocase(char const *str);
|
||||
|
||||
static unsigned int HashUserFunc(void *x)
|
||||
{
|
||||
UserFunc *f = (UserFunc *) x;
|
||||
return HashVal_nocase(f->name);
|
||||
return HashVal_preservecase(f->name);
|
||||
}
|
||||
|
||||
static int CompareUserFuncs(void *a, void *b)
|
||||
@@ -64,11 +63,11 @@ InitUserFunctions(void)
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* HashVal */
|
||||
/* HashVal_preservecase */
|
||||
/* Given a string, compute the hash value. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
unsigned int HashVal_nocase(char const *str)
|
||||
unsigned int HashVal_preservecase(char const *str)
|
||||
{
|
||||
unsigned int h = 0, high;
|
||||
while(*str) {
|
||||
|
||||
@@ -40,7 +40,7 @@ static hash_table VHashTbl;
|
||||
static unsigned int VarHashFunc(void *x)
|
||||
{
|
||||
Var *v = (Var *) x;
|
||||
return HashVal(v->name);
|
||||
return HashVal_ignorecase(v->name);
|
||||
}
|
||||
|
||||
static int VarCompareFunc(void *a, void *b)
|
||||
@@ -477,11 +477,11 @@ static int time_sep_func(int do_set, Value *val)
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* HashVal */
|
||||
/* Given a string, compute the hash value. */
|
||||
/* HashVal_ignorecase */
|
||||
/* Given a string, compute the hash value case-insensitively */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
unsigned int HashVal(char const *str)
|
||||
unsigned int HashVal_ignorecase(char const *str)
|
||||
{
|
||||
unsigned int h = 0, high;
|
||||
while(*str) {
|
||||
|
||||
@@ -6033,41 +6033,41 @@ SET $Friday "TxFriday"
|
||||
SET $Saturday "TxSaturday"
|
||||
SET $Sunday "TxSunday"
|
||||
TRANSLATE DUMP
|
||||
"April" "TxApril"
|
||||
"Quux" "OOOGHY"
|
||||
"hour" "Txhour"
|
||||
"am" "Txam"
|
||||
"now" "Txnow"
|
||||
"tomorrow" "Txtomorrow"
|
||||
"January" "TxJanuary"
|
||||
"on" "Txon"
|
||||
"May" "TxMay"
|
||||
"October" "TxOctober"
|
||||
"Thursday" "TxThursday"
|
||||
"and" "Txand"
|
||||
"was" "Txwas"
|
||||
"July" "TxJuly"
|
||||
"at" "Txat"
|
||||
"February" "TxFebruary"
|
||||
"Sunday" "TxSunday"
|
||||
"Wednesday" "TxWednesday"
|
||||
"minute" "Txminute"
|
||||
"December" "TxDecember"
|
||||
"ago" "Txago"
|
||||
"pm" "Txpm"
|
||||
"March" "TxMarch"
|
||||
"Friday" "TxFriday"
|
||||
"Wookie" "Bar"
|
||||
"Friday" "TxFriday"
|
||||
"Monday" "TxMonday"
|
||||
"September" "TxSeptember"
|
||||
"June" "TxJune"
|
||||
"Tuesday" "TxTuesday"
|
||||
"is" "Txis"
|
||||
"at" "Txat"
|
||||
"from now" "Txfromnow"
|
||||
"Thursday" "TxThursday"
|
||||
"August" "TxAugust"
|
||||
"November" "TxNovember"
|
||||
"from now" "Txfromnow"
|
||||
"Saturday" "TxSaturday"
|
||||
"March" "TxMarch"
|
||||
"Quux" "OOOGHY"
|
||||
"now" "Txnow"
|
||||
"today" "Txtoday"
|
||||
"February" "TxFebruary"
|
||||
"pm" "Txpm"
|
||||
"and" "Txand"
|
||||
"was" "Txwas"
|
||||
"minute" "Txminute"
|
||||
"tomorrow" "Txtomorrow"
|
||||
"July" "TxJuly"
|
||||
"is" "Txis"
|
||||
"April" "TxApril"
|
||||
"ago" "Txago"
|
||||
"December" "TxDecember"
|
||||
"hour" "Txhour"
|
||||
"October" "TxOctober"
|
||||
"June" "TxJune"
|
||||
"January" "TxJanuary"
|
||||
"Wednesday" "TxWednesday"
|
||||
"Sunday" "TxSunday"
|
||||
"am" "Txam"
|
||||
"September" "TxSeptember"
|
||||
"on" "Txon"
|
||||
"May" "TxMay"
|
||||
"Saturday" "TxSaturday"
|
||||
|
||||
DO torture-test.rem
|
||||
# Turn off some debugging to make output a bit easier on the eyes...
|
||||
@@ -16075,7 +16075,7 @@ Dedup-9998
|
||||
Dedup-9999
|
||||
Var hash: total = 100141; maxlen = 5; avglen = 1.142
|
||||
Func hash: total = 100016; maxlen = 5; avglen = 1.140
|
||||
Dedup hash: total = 10000; maxlen = 6; avglen = 1.828
|
||||
Dedup hash: total = 10000; maxlen = 7; avglen = 1.828
|
||||
Trans hash: total = 1; maxlen = 1; avglen = 0.059
|
||||
Expression nodes allocated: 300096
|
||||
Expression nodes high-water: 300073
|
||||
|
||||
Reference in New Issue
Block a user