]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2004-03-03 04:44:16 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Wed, 3 Mar 2004 04:44:16 +0000 (04:44 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Wed, 3 Mar 2004 04:44:16 +0000 (04:44 +0000)
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

13 files changed:
drv_generic_parport.c
drv_generic_serial.c
hash.c
hash.h
lcd4linux.c
pid.c
plugin_imon.c
plugin_netdev.c
plugin_ppp.c
plugin_proc_stat.c
qprintf.h
timer.c
widget_icon.c

index c9aac3db56ee2c0efa31a665de134b673b304260..f20feccc0643ae1c9df9ba2a2f8448885dbae72c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_parport.c,v 1.3 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: drv_generic_parport.c,v 1.4 2004/03/03 04:44:16 reinelt Exp $
  *
  * generic driver helper for serial and parport access
  *
  *
  *
  * $Log: drv_generic_parport.c,v $
+ * Revision 1.4  2004/03/03 04:44:16  reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
  * Revision 1.3  2004/03/03 03:47:04  reinelt
  * big patch from Martin Hejl:
  * - use qprintf() where appropriate
 #endif
 
 #include "debug.h"
+#include "qprintf.h"
 #include "cfg.h"
 #include "udelay.h"
 #include "drv_generic_parport.h"
-#include "qprintf.h"
 
 
 static char *Driver="";
index a4cb31289725f69ed4f4aaa2725d5d032754587d..91db7b7f84e15be08b03116d35b53a9af369d6db 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_serial.c,v 1.7 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: drv_generic_serial.c,v 1.8 2004/03/03 04:44:16 reinelt Exp $
  *
  * generic driver helper for serial and usbserial displays
  *
  *
  *
  * $Log: drv_generic_serial.c,v $
+ * Revision 1.8  2004/03/03 04:44:16  reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
  * Revision 1.7  2004/03/03 03:47:04  reinelt
  * big patch from Martin Hejl:
  * - use qprintf() where appropriate
 #include <sys/stat.h>
 
 #include "debug.h"
+#include "qprintf.h"
 #include "cfg.h"
 #include "drv_generic_serial.h"
-#include "qprintf.h"
 
 
 static char   *Driver;
diff --git a/hash.c b/hash.c
index f263e8a0cb75dac8e2ddcfdddb0a44bfd76ffe39..72e522a42104f30a5d97ee2ab121722ce76aba32 100644 (file)
--- 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)
  *
  *
  *
  * $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
 
 #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;
 
diff --git a/hash.h b/hash.h
index 1130661ed081a1b91b4a488dbe7014854f2cf66f..a06ec6a1da96f694fc530ab9949b811b2fbe6549 100644 (file)
--- a/hash.h
+++ b/hash.h
@@ -1,4 +1,4 @@
-/* $Id: hash.h,v 1.9 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: hash.h,v 1.10 2004/03/03 04:44:16 reinelt Exp $
  *
  * hashes (associative arrays)
  *
  *
  *
  * $Log: hash.h,v $
+ * Revision 1.10  2004/03/03 04:44:16  reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
  * Revision 1.9  2004/03/03 03:47:04  reinelt
  * big patch from Martin Hejl:
  * - use qprintf() where appropriate
@@ -102,8 +106,4 @@ char  *hash_get       (HASH *Hash, char *key);
 double hash_get_delta (HASH *Hash, char *key, int delay);
 double hash_get_regex (HASH *Hash, char *key, int delay);
 void   hash_destroy   (HASH *Hash);
-
-int gettimeofday_ex(struct timeval *tv, struct timezone *tz); 
-void gettimeofday_update();
-
 #endif
index 5d73d34b903ca581e1d2606afb56ad6c7dfd80e0..0f80dada166f635c5adfec3947823d7574656478 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: lcd4linux.c,v 1.65 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.66 2004/03/03 04:44:16 reinelt Exp $
  *
  * LCD4Linux
  *
  *
  *
  * $Log: lcd4linux.c,v $
+ * Revision 1.66  2004/03/03 04:44:16  reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
  * Revision 1.65  2004/03/03 03:47:04  reinelt
  * big patch from Martin Hejl:
  * - use qprintf() where appropriate
 
 #include "cfg.h"
 #include "debug.h"
+#include "qprintf.h"
 #include "pid.h"
 #include "udelay.h"
 #include "drv.h"
 #include "layout.h"
 #include "plugin.h"
 
-#include "qprintf.h"
 
 #ifdef WITH_DMALLOC
 #include <dmalloc.h>
diff --git a/pid.c b/pid.c
index 743470a9af9ca598c9ffc633323b75f816bf98cf..3c7ca18bf6cb80b50274457d36c4a58875d02a13 100644 (file)
--- a/pid.c
+++ b/pid.c
@@ -1,4 +1,4 @@
-/* $Id: pid.c,v 1.4 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: pid.c,v 1.5 2004/03/03 04:44:16 reinelt Exp $
  *
  * PID file handling
  *
  *
  *
  * $Log: pid.c,v $
+ * Revision 1.5  2004/03/03 04:44:16  reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
  * Revision 1.4  2004/03/03 03:47:04  reinelt
  * big patch from Martin Hejl:
  * - use qprintf() where appropriate
@@ -71,6 +75,7 @@
 #include "pid.h"
 #include "qprintf.h"
 
+
 int pid_init (const char *pidfile)
 {
   char tmpfile[256];
index b2ec22fb3dd871c605b4e64b66be6931d34d924b..7debb54b9114ef0229e8745d656fc35210e1a15d 100755 (executable)
@@ -1,4 +1,4 @@
-/* $Id: plugin_imon.c,v 1.3 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: plugin_imon.c,v 1.4 2004/03/03 04:44:16 reinelt Exp $
  *
  * imond/telmond data processing
  *
  *
  *
  * $Log: plugin_imon.c,v $
+ * Revision 1.4  2004/03/03 04:44:16  reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
  * Revision 1.3  2004/03/03 03:47:04  reinelt
  * big patch from Martin Hejl:
  * - use qprintf() where appropriate
@@ -41,9 +45,9 @@
 #include "config.h"
 #include "debug.h"
 #include "plugin.h"
+#include "qprintf.h"
 #include "cfg.h"
 #include "hash.h"
-#include "qprintf.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -436,9 +440,9 @@ int plugin_init_imon (void){
        
  if (telmon=='\1') AddFunction ("telmon", 1, my_telmon);
  if (imon=='\1'){
-  AddFunction ("imon", 1, my_imon);
-  AddFunction ("version", 0, my_imon_version);
-  AddFunction ("rates", 2, my_imon_rates);
+   AddFunction ("imon", 1, my_imon);
+   AddFunction ("version", 0, my_imon_version);
+   AddFunction ("rates", 2, my_imon_rates);
  }
 
  return 0;
@@ -446,6 +450,6 @@ int plugin_init_imon (void){
 
 void plugin_exit_imon(void) 
 {
-       hash_destroy(&TELMON);
-       hash_destroy(&IMON);
+  hash_destroy(&TELMON);
+  hash_destroy(&IMON);
 }
index eb9673632ae69b75a102becfc63c7516ff07dc4f..1668498291f83b212dd040b09005df4576185dfa 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: plugin_netdev.c,v 1.5 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: plugin_netdev.c,v 1.6 2004/03/03 04:44:16 reinelt Exp $
  *
  * plugin for /proc/net/dev parsing
  *
  *
  *
  * $Log: plugin_netdev.c,v $
+ * Revision 1.6  2004/03/03 04:44:16  reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
  * Revision 1.5  2004/03/03 03:47:04  reinelt
  * big patch from Martin Hejl:
  * - use qprintf() where appropriate
@@ -63,9 +67,8 @@
 
 #include "debug.h"
 #include "plugin.h"
-
-#include "hash.h"
 #include "qprintf.h"
+#include "hash.h"
 
 
 static HASH NetDev = { 0, };
index e3c257ba4a1b061d5bf5fe8543980a241620fe8e..44d55ad5d7e6215e4a7aa2095be796c63404b0ef 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: plugin_ppp.c,v 1.3 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: plugin_ppp.c,v 1.4 2004/03/03 04:44:16 reinelt Exp $
  *
  * plugin for ppp throughput
  *
  *
  *
  * $Log: plugin_ppp.c,v $
+ * Revision 1.4  2004/03/03 04:44:16  reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
  * Revision 1.3  2004/03/03 03:47:04  reinelt
  * big patch from Martin Hejl:
  * - use qprintf() where appropriate
@@ -62,8 +66,8 @@
 
 #include "debug.h"
 #include "plugin.h"
-#include "hash.h"
 #include "qprintf.h"
+#include "hash.h"
 
 #ifdef HAVE_NET_IF_PPP_H
 
index d3b4815d9e1e9ec93c609c021780b96806dd452c..72de48e9017c27b2c72e664741f73f5e1726c33c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: plugin_proc_stat.c,v 1.16 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: plugin_proc_stat.c,v 1.17 2004/03/03 04:44:16 reinelt Exp $
  *
  * plugin for /proc/stat parsing
  *
  *
  *
  * $Log: plugin_proc_stat.c,v $
+ * Revision 1.17  2004/03/03 04:44:16  reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
  * Revision 1.16  2004/03/03 03:47:04  reinelt
  * big patch from Martin Hejl:
  * - use qprintf() where appropriate
 
 #include "debug.h"
 #include "plugin.h"
-#include "hash.h"
 #include "qprintf.h"
+#include "hash.h"
 
 
 static HASH Stat = { 0, };
@@ -209,7 +213,7 @@ static int parse_proc_stat (void)
        while (strchr(delim, *beg)) beg++; 
        if ((end=strpbrk(beg, delim))) *end='\0'; 
        if (i==0) 
-         strncpy(num,"sum",sizeof(num));
+         strcpy(num, "sum");
        else 
          qprintf(num, sizeof(num), "%d", i-1);
        hash_set2 ("intr", num,  beg);
@@ -353,5 +357,5 @@ int plugin_init_proc_stat (void)
 
 void plugin_exit_proc_stat(void) 
 {
-       hash_destroy(&Stat);
+  hash_destroy(&Stat);
 }
index 72c0c1bc6ed14ecbffff280c7d7acfe2f4c7e58a..ec00f280c82c3f13912ec8ca1b4289b8565bc87d 100644 (file)
--- a/qprintf.h
+++ b/qprintf.h
@@ -1,4 +1,4 @@
-/* $Id: qprintf.h,v 1.1 2004/02/27 07:06:26 reinelt Exp $
+/* $Id: qprintf.h,v 1.2 2004/03/03 04:44:16 reinelt Exp $
  *
  * simple but quick snprintf() replacement
  *
  *
  *
  * $Log: qprintf.h,v $
+ * Revision 1.2  2004/03/03 04:44:16  reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
  * Revision 1.1  2004/02/27 07:06:26  reinelt
  * new function 'qprintf()' (simple but quick snprintf() replacement)
  *
@@ -34,6 +38,9 @@
 #ifndef _QPRINTF_H_
 #define _QPRINTF_H_
 
+// size_t
+#include <stdio.h>
+
 int qprintf(char *str, size_t size, const char *format, ...);
 
 #endif
diff --git a/timer.c b/timer.c
index 262a54386eefd1b232f492af7c3671049419ca2c..ed987833db3af42a8900fba7f4989f2c65517ab4 100644 (file)
--- a/timer.c
+++ b/timer.c
@@ -1,4 +1,4 @@
-/* $Id: timer.c,v 1.5 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: timer.c,v 1.6 2004/03/03 04:44:16 reinelt Exp $
  *
  * generic timer handling
  *
  *
  *
  * $Log: timer.c,v $
+ * Revision 1.6  2004/03/03 04:44:16  reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
  * Revision 1.5  2004/03/03 03:47:04  reinelt
  * big patch from Martin Hejl:
  * - use qprintf() where appropriate
@@ -195,9 +199,13 @@ int timer_process (struct timespec *delay)
   
 }
 
-void timer_exit() {
-  if (nTimers>0) {
-    nTimers=0;
+
+void timer_exit(void) {
+
+  nTimers=0;
+
+  if (Timers>0) {
     free(Timers);;     
+    Timers=NULL;
   }
 }
index 6a6ad6bf5b07b660a8f202fd0f164f1c3acd6499..2580dc68d91658d987881825796b30bf994288e7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: widget_icon.c,v 1.8 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: widget_icon.c,v 1.9 2004/03/03 04:44:16 reinelt Exp $
  *
  * icon widget handling
  *
  *
  *
  * $Log: widget_icon.c,v $
+ * Revision 1.9  2004/03/03 04:44:16  reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
  * Revision 1.8  2004/03/03 03:47:04  reinelt
  * big patch from Martin Hejl:
  * - use qprintf() where appropriate
 
 #include "debug.h"
 #include "cfg.h"
+#include "qprintf.h"
 #include "evaluator.h"
 #include "timer.h"
 #include "widget.h"
 #include "widget_icon.h"
-#include "qprintf.h"
 
 #ifdef WITH_DMALLOC
 #include <dmalloc.h>
@@ -212,11 +216,9 @@ int widget_icon_init (WIDGET *Self)
 
 int widget_icon_quit (WIDGET *Self) 
 {
-  WIDGET_ICON *Icon;
-  
   if (Self) {
-       Icon = Self->data;
-    if (Icon) {
+    if (Self->data) {
+      WIDGET_ICON *Icon = Self->data;
       if (Icon->bitmap) free (Icon->bitmap); 
       free(Self->data);
       Self->data=NULL;