aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_xmms.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-06-17 06:23:43 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-06-17 06:23:43 +0000
commit1d354fd87d4c07906e82d104ba8614d30ae9cbbe (patch)
treeca9aafd446dda125df1411933930669d303c9a30 /plugin_xmms.c
parente8e56418dc7375b50f36e930fb6752fbe25b4ae1 (diff)
downloadlcd4linux-1d354fd87d4c07906e82d104ba8614d30ae9cbbe.tar.gz
[lcd4linux @ 2004-06-17 06:23:39 by reinelt]
hash handling rewritten to solve performance issues git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@473 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'plugin_xmms.c')
-rw-r--r--plugin_xmms.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/plugin_xmms.c b/plugin_xmms.c
index 25d3add..e38ef6e 100644
--- a/plugin_xmms.c
+++ b/plugin_xmms.c
@@ -1,4 +1,4 @@
-/* $Id: plugin_xmms.c,v 1.9 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: plugin_xmms.c,v 1.10 2004/06/17 06:23:43 reinelt Exp $
*
* XMMS-Plugin for LCD4Linux
* Copyright 2003 Markus Keil <markus_keil@t-online.de>
@@ -21,6 +21,10 @@
*
*
* $Log: plugin_xmms.c,v $
+ * Revision 1.10 2004/06/17 06:23:43 reinelt
+ *
+ * hash handling rewritten to solve performance issues
+ *
* Revision 1.9 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
@@ -95,7 +99,7 @@
#include "plugin.h"
-static HASH xmms = { 0, };
+static HASH xmms;
static int parse_xmms_info (void)
@@ -105,7 +109,7 @@ static int parse_xmms_info (void)
char zeile[200];
// reread every 100msec only
- age=hash_age(&xmms, NULL, NULL);
+ age=hash_age(&xmms, NULL);
if (age>=0 && age<=200) return 0;
// Open Filestream for '/tmp/xmms-info'
xmms_stream = fopen("/tmp/xmms-info","r");
@@ -131,7 +135,7 @@ static int parse_xmms_info (void)
// strip trailing blanks from value
for (c=val; *c!='\0';c++);
while (isspace(*--c)) *c='\0';
- hash_set (&xmms, key, val);
+ hash_put (&xmms, key, val);
}
fclose(xmms_stream);
@@ -149,7 +153,7 @@ static void my_xmms (RESULT *result, RESULT *arg1)
}
key=R2S(arg1);
- val=hash_get(&xmms, key);
+ val=hash_get(&xmms, key, NULL);
if (val==NULL) val="";
SetResult(&result, R_STRING, val);
@@ -158,6 +162,7 @@ static void my_xmms (RESULT *result, RESULT *arg1)
int plugin_init_xmms (void)
{
+ hash_create(&xmms);
// register xmms info
AddFunction ("xmms", 1, my_xmms);
@@ -167,5 +172,5 @@ int plugin_init_xmms (void)
void plugin_exit_xmms(void)
{
- hash_destroy(&xmms);
+ hash_destroy(&xmms);
}