aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-03-03 04:44:16 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-03-03 04:44:16 +0000
commitb9a217e0dc5906e07b9f1e4674e9b797b6dd9b46 (patch)
treebf6491cefb0134736fc5f971226f54074be7324f /hash.c
parent9ef4282e9e32e857f4d0cac9df6d58f2cba159f4 (diff)
downloadlcd4linux-b9a217e0dc5906e07b9f1e4674e9b797b6dd9b46.tar.gz
[lcd4linux @ 2004-03-03 04:44:16 by reinelt]
changes (cosmetics?) to the big patch from Martin hash patch un-applied git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@385 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
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;