mirror of
https://github.com/netfun2000/lcd4linux.git
synced 2026-02-27 09:44:34 +08:00
[lcd4linux @ 2004-03-03 03:47:04 by reinelt]
big patch from Martin Hejl: - use qprintf() where appropriate - save CPU cycles on gettimeofday() - add quit() functions to free allocated memory - fixed lots of memory leaks git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@384 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
This commit is contained in:
36
plugin_cfg.c
36
plugin_cfg.c
@@ -1,4 +1,4 @@
|
||||
/* $Id: plugin_cfg.c,v 1.5 2004/02/01 19:37:40 reinelt Exp $
|
||||
/* $Id: plugin_cfg.c,v 1.6 2004/03/03 03:47:04 reinelt Exp $
|
||||
*
|
||||
* plugin for config file access
|
||||
*
|
||||
@@ -23,6 +23,13 @@
|
||||
*
|
||||
*
|
||||
* $Log: plugin_cfg.c,v $
|
||||
* Revision 1.6 2004/03/03 03:47:04 reinelt
|
||||
* big patch from Martin Hejl:
|
||||
* - use qprintf() where appropriate
|
||||
* - save CPU cycles on gettimeofday()
|
||||
* - add quit() functions to free allocated memory
|
||||
* - fixed lots of memory leaks
|
||||
*
|
||||
* Revision 1.5 2004/02/01 19:37:40 reinelt
|
||||
* got rid of every strtok() incarnation.
|
||||
*
|
||||
@@ -87,13 +94,13 @@ static void load_variables (void)
|
||||
} else {
|
||||
expression=cfg_get_raw (section, l, "");
|
||||
if (expression!=NULL && *expression!='\0') {
|
||||
if (Eval(expression, &result)==0) {
|
||||
debug ("Variable %s = '%s' (%f)", l, R2S(&result), R2N(&result));
|
||||
SetVariable (l, &result);
|
||||
DelResult (&result);
|
||||
} else {
|
||||
error ("error evaluating variable '%s' from %s", list, cfg_source());
|
||||
}
|
||||
if (Eval(expression, &result)==0) {
|
||||
debug ("Variable %s = '%s' (%f)", l, R2S(&result), R2N(&result));
|
||||
SetVariable (l, &result);
|
||||
DelResult (&result);
|
||||
} else {
|
||||
error ("error evaluating variable '%s' from %s", list, cfg_source());
|
||||
}
|
||||
}
|
||||
}
|
||||
l=p?p+1:NULL;
|
||||
@@ -127,12 +134,14 @@ static void my_cfg (RESULT *result, int argc, RESULT *argv[])
|
||||
|
||||
// buffer starts with '.', so cut off first char
|
||||
value=cfg_get("", buffer+1, "");
|
||||
|
||||
|
||||
// store result
|
||||
SetResult(&result, R_STRING, value);
|
||||
|
||||
// free buffer again
|
||||
free (buffer);
|
||||
|
||||
// store result
|
||||
SetResult(&result, R_STRING, value);
|
||||
free(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,3 +155,8 @@ int plugin_init_cfg (void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void plugin_exit_cfg(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user