aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--drv_generic_parport.c8
-rw-r--r--drv_generic_serial.c8
-rw-r--r--hash.c32
-rw-r--r--hash.h10
-rw-r--r--lcd4linux.c8
-rw-r--r--pid.c7
-rwxr-xr-xplugin_imon.c18
-rw-r--r--plugin_netdev.c9
-rw-r--r--plugin_ppp.c8
-rw-r--r--plugin_proc_stat.c12
-rw-r--r--qprintf.h9
-rw-r--r--timer.c16
-rw-r--r--widget_icon.c14
13 files changed, 96 insertions, 63 deletions
diff --git a/drv_generic_parport.c b/drv_generic_parport.c
index c9aac3d..f20fecc 100644
--- a/drv_generic_parport.c
+++ b/drv_generic_parport.c
@@ -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
*
@@ -23,6 +23,10 @@
*
*
* $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
@@ -89,10 +93,10 @@
#endif
#include "debug.h"
+#include "qprintf.h"
#include "cfg.h"
#include "udelay.h"
#include "drv_generic_parport.h"
-#include "qprintf.h"
static char *Driver="";
diff --git a/drv_generic_serial.c b/drv_generic_serial.c
index a4cb312..91db7b7 100644
--- a/drv_generic_serial.c
+++ b/drv_generic_serial.c
@@ -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
*
@@ -23,6 +23,10 @@
*
*
* $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
@@ -99,9 +103,9 @@
#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 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;
diff --git a/hash.h b/hash.h
index 1130661..a06ec6a 100644
--- 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)
*
@@ -23,6 +23,10 @@
*
*
* $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
diff --git a/lcd4linux.c b/lcd4linux.c
index 5d73d34..0f80dad 100644
--- a/lcd4linux.c
+++ b/lcd4linux.c
@@ -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
*
@@ -22,6 +22,10 @@
*
*
* $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
@@ -321,6 +325,7 @@
#include "cfg.h"
#include "debug.h"
+#include "qprintf.h"
#include "pid.h"
#include "udelay.h"
#include "drv.h"
@@ -328,7 +333,6 @@
#include "layout.h"
#include "plugin.h"
-#include "qprintf.h"
#ifdef WITH_DMALLOC
#include <dmalloc.h>
diff --git a/pid.c b/pid.c
index 743470a..3c7ca18 100644
--- 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
*
@@ -22,6 +22,10 @@
*
*
* $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];
diff --git a/plugin_imon.c b/plugin_imon.c
index b2ec22f..7debb54 100755
--- a/plugin_imon.c
+++ b/plugin_imon.c
@@ -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
*
@@ -22,6 +22,10 @@
*
*
* $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);
}
diff --git a/plugin_netdev.c b/plugin_netdev.c
index eb96736..1668498 100644
--- a/plugin_netdev.c
+++ b/plugin_netdev.c
@@ -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
*
@@ -23,6 +23,10 @@
*
*
* $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, };
diff --git a/plugin_ppp.c b/plugin_ppp.c
index e3c257b..44d55ad 100644
--- a/plugin_ppp.c
+++ b/plugin_ppp.c
@@ -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
*
@@ -23,6 +23,10 @@
*
*
* $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
diff --git a/plugin_proc_stat.c b/plugin_proc_stat.c
index d3b4815..72de48e 100644
--- a/plugin_proc_stat.c
+++ b/plugin_proc_stat.c
@@ -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
*
@@ -23,6 +23,10 @@
*
*
* $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
@@ -103,8 +107,8 @@
#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);
}
diff --git a/qprintf.h b/qprintf.h
index 72c0c1b..ec00f28 100644
--- 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
*
@@ -26,6 +26,10 @@
*
*
* $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 262a543..ed98783 100644
--- 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
*
@@ -21,6 +21,10 @@
*
*
* $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;
}
}
diff --git a/widget_icon.c b/widget_icon.c
index 6a6ad6b..2580dc6 100644
--- a/widget_icon.c
+++ b/widget_icon.c
@@ -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
*
@@ -21,6 +21,10 @@
*
*
* $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
@@ -73,11 +77,11 @@
#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;