mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-15 19:56:55 +00:00
convert iconv objects to callbacks
This commit is contained in:
parent
b8e600b9a4
commit
938af98ff3
@ -1101,15 +1101,6 @@ void generate_text_internal(char *p, int p_max_size,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_ICONV
|
|
||||||
OBJ(iconv_start) {
|
|
||||||
do_iconv_start(obj);
|
|
||||||
}
|
|
||||||
OBJ(iconv_stop) {
|
|
||||||
do_iconv_stop();
|
|
||||||
}
|
|
||||||
#endif /* HAVE_ICONV */
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#undef DO_JUMP
|
#undef DO_JUMP
|
||||||
|
@ -1042,8 +1042,11 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
#ifdef HAVE_ICONV
|
#ifdef HAVE_ICONV
|
||||||
END OBJ_ARG(iconv_start, 0, "Iconv requires arguments")
|
END OBJ_ARG(iconv_start, 0, "Iconv requires arguments")
|
||||||
init_iconv_start(obj, free_at_crash, arg);
|
init_iconv_start(obj, free_at_crash, arg);
|
||||||
|
obj->callbacks.print = &print_iconv_start;
|
||||||
|
obj->callbacks.free = &free_iconv;
|
||||||
END OBJ(iconv_stop, 0)
|
END OBJ(iconv_stop, 0)
|
||||||
init_iconv_stop();
|
init_iconv_stop();
|
||||||
|
obj->callbacks.print = &print_iconv_stop;
|
||||||
#endif
|
#endif
|
||||||
END OBJ(totaldown, &update_net_stats)
|
END OBJ(totaldown, &update_net_stats)
|
||||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||||
@ -1832,11 +1835,6 @@ void free_text_objects(struct text_object *root, int internal)
|
|||||||
case OBJ_text:
|
case OBJ_text:
|
||||||
free(data.s);
|
free(data.s);
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_ICONV
|
|
||||||
case OBJ_iconv_start:
|
|
||||||
free_iconv();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
case OBJ_if_gw:
|
case OBJ_if_gw:
|
||||||
case OBJ_gw_iface:
|
case OBJ_gw_iface:
|
||||||
|
@ -58,10 +58,12 @@ int register_iconv(iconv_t *new_iconv)
|
|||||||
return iconv_count;
|
return iconv_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_iconv(void)
|
void free_iconv(struct text_object *obj)
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
|
(void)obj;
|
||||||
|
|
||||||
if (!iconv_cd)
|
if (!iconv_cd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -139,14 +141,21 @@ void init_iconv_stop(void)
|
|||||||
iconv_converting = 0;
|
iconv_converting = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_iconv_start(struct text_object *obj)
|
void print_iconv_start(struct text_object *obj, char *p, int p_max_size)
|
||||||
{
|
{
|
||||||
|
(void)p;
|
||||||
|
(void)p_max_size;
|
||||||
|
|
||||||
iconv_converting = 1;
|
iconv_converting = 1;
|
||||||
iconv_selected = obj->data.i;
|
iconv_selected = obj->data.i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_iconv_stop(void)
|
void print_iconv_stop(struct text_object *obj, char *p, int p_max_size)
|
||||||
{
|
{
|
||||||
|
(void)obj;
|
||||||
|
(void)p;
|
||||||
|
(void)p_max_size;
|
||||||
|
|
||||||
iconv_converting = 0;
|
iconv_converting = 0;
|
||||||
iconv_selected = 0;
|
iconv_selected = 0;
|
||||||
}
|
}
|
||||||
|
@ -31,11 +31,12 @@
|
|||||||
#ifndef _ICONV_TOOLS_H
|
#ifndef _ICONV_TOOLS_H
|
||||||
#define _ICONV_TOOLS_H
|
#define _ICONV_TOOLS_H
|
||||||
|
|
||||||
void free_iconv(void);
|
void free_iconv(struct text_object *);
|
||||||
void iconv_convert(size_t *, char *, char *, size_t);
|
void iconv_convert(size_t *, char *, char *, size_t);
|
||||||
void init_iconv_start(struct text_object *, void *, const char *);
|
void init_iconv_start(struct text_object *, void *, const char *);
|
||||||
void init_iconv_stop(void);
|
void init_iconv_stop(void);
|
||||||
void do_iconv_start(struct text_object *);
|
|
||||||
void do_iconv_stop(void);
|
void print_iconv_start(struct text_object *, char *, int);
|
||||||
|
void print_iconv_stop(struct text_object *, char *, int);
|
||||||
|
|
||||||
#endif /* _ICONV_TOOLS_H */
|
#endif /* _ICONV_TOOLS_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user