1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-05 21:07:52 +00:00

convert acpitemp to callbacks.{print,free}

This commit is contained in:
Phil Sutter 2009-11-26 01:38:53 +01:00
parent a67ab7a3c8
commit 31c3734cc8
4 changed files with 20 additions and 10 deletions

View File

@ -34,6 +34,7 @@
#include "logging.h"
#include "net_stat.h"
#include "specials.h"
#include "temphelper.h"
#include "timeinfo.h"
#include "top.h"
#include <ctype.h>
@ -675,3 +676,15 @@ int if_running_iftest(struct text_object *obj)
}
return 1;
}
#ifndef __OpenBSD__
void print_acpitemp(struct text_object *obj, char *p, int p_max_size)
{
temp_print(p, p_max_size, get_acpi_temperature(obj->data.i), TEMP_CELSIUS);
}
void free_acpitemp(struct text_object *obj)
{
close(obj->data.i);
}
#endif /* !__OpenBSD__ */

View File

@ -108,4 +108,9 @@ int if_empty_iftest(struct text_object *);
int if_existing_iftest(struct text_object *);
int if_running_iftest(struct text_object *);
#ifndef __OpenBSD__
void print_acpitemp(struct text_object *, char *, int);
void free_acpitemp(struct text_object *);
#endif /* !__OpenBSD__ */
#endif /* _COMMON_H */

View File

@ -798,11 +798,6 @@ void generate_text_internal(char *p, int p_max_size,
switch (obj->type) {
default:
NORM_ERR("not implemented obj type %d", obj->type);
#ifndef __OpenBSD__
OBJ(acpitemp) {
temp_print(p, p_max_size, get_acpi_temperature(obj->data.i), TEMP_CELSIUS);
}
#endif /* !__OpenBSD__ */
OBJ(freq) {
static int ok = 1;
if (ok) {

View File

@ -160,6 +160,8 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
#else
OBJ(acpitemp, 0)
obj->data.i = open_acpi_temperature(arg);
obj->callbacks.print = &print_acpitemp;
obj->callbacks.free = &free_acpitemp;
END OBJ(acpiacadapter, 0)
END OBJ(freq, 0)
#endif /* !__OpenBSD__ */
@ -1746,11 +1748,6 @@ void free_text_objects(struct text_object *root, int internal)
}
switch (obj->type) {
#ifndef __OpenBSD__
case OBJ_acpitemp:
close(data.i);
break;
#endif /* !__OpenBSD__ */
case OBJ_cmdline_to_pid:
free(data.s);
break;