aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authorreinelt <>2004-03-03 04:44:16 +0000
committerreinelt <>2004-03-03 04:44:16 +0000
commit9343d98c97ce8130374cd1c6b702c336e1ae0666 (patch)
treebf6491cefb0134736fc5f971226f54074be7324f /hash.c
parent9b7d2e2732d586f86c3458053a20120b79936621 (diff)
downloadlcd4linux-9343d98c97ce8130374cd1c6b702c336e1ae0666.tar.gz
[lcd4linux @ 2004-03-03 04:44:16 by reinelt]
changes (cosmetics?) to the big patch from Martin hash patch un-applied
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/hash.c b/hash.c
index f263e8a..72e522a 100644
--- a/hash.c
+++ b/hash.c
@@ -1,4 +1,4 @@
-/* $Id: hash.c,v 1.14 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: hash.c,v 1.15 2004/03/03 04:44:16 reinelt Exp $
*
* hashes (associative arrays)
*
@@ -23,6 +23,10 @@
*
*
* $Log: hash.c,v $
+ * Revision 1.15 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.14 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
@@ -108,24 +112,6 @@
#define DELTA_SLOTS 64
-static timeval __my_time_of_day;
-
-int gettimeofday_ex(timeval *tv, struct timezone *tz) {
- if (tv==NULL) return -1;
-
- if (__my_time_of_day.tv_usec == 0 && __my_time_of_day.tv_sec==0) {
- gettimeofday_update();
- }
-
- tv->tv_sec = __my_time_of_day.tv_sec;
- tv->tv_usec= __my_time_of_day.tv_usec;
- return 0;
-}
-
-void gettimeofday_update(){
- gettimeofday(&__my_time_of_day, NULL);
-}
-
// bsearch compare function for hash entries
static int hash_lookup_f (const void *a, const void *b)
@@ -216,7 +202,7 @@ static HASH_ITEM* hash_set_string (HASH *Hash, char *key, char *val)
hash_got_string:
// set timestamps
- gettimeofday_ex(&Hash->time, NULL);
+ gettimeofday(&Hash->time, NULL);
Item->time=Hash->time;
return Item;
@@ -256,7 +242,7 @@ void hash_set_delta (HASH *Hash, char *key, char *val)
if (--Item->root < 0) Item->root = DELTA_SLOTS-1;
// set first entry
- gettimeofday_ex(&(Item->Slot[Item->root].time), NULL);
+ gettimeofday(&(Item->Slot[Item->root].time), NULL);
Item->Slot[Item->root].val=number;
}
@@ -280,8 +266,6 @@ int hash_age (HASH *Hash, char *key, char **value)
timeval now, *stamp;
int age;
- gettimeofday_update();
-
if (key!=NULL) {
Item=hash_lookup(Hash, key, 1);
if (value) *value=Item?Item->val:NULL;
@@ -293,7 +277,7 @@ int hash_age (HASH *Hash, char *key, char **value)
stamp=&Hash->time;
}
- gettimeofday_ex(&now, NULL);
+ gettimeofday(&now, NULL);
age = (now.tv_sec - stamp->tv_sec)*1000 + (now.tv_usec - stamp->tv_usec)/1000;