mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-27 12:42:41 +00:00
convert nameserver to callbacks.free
This commit is contained in:
parent
781bc7b024
commit
4c4a7c4096
@ -640,6 +640,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
END OBJ(nameserver, &update_dns_data)
|
||||
parse_nameserver_arg(obj, arg);
|
||||
obj->callbacks.print = &print_nameserver;
|
||||
obj->callbacks.free = &free_dns_data;
|
||||
END OBJ(offset, 0)
|
||||
obj->data.l = arg ? atoi(arg) : 1;
|
||||
obj->callbacks.print = &new_offset;
|
||||
@ -1848,9 +1849,6 @@ void free_text_objects(struct text_object *root, int internal)
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case OBJ_nameserver:
|
||||
free_dns_data();
|
||||
break;
|
||||
#ifdef __linux__
|
||||
case OBJ_top:
|
||||
case OBJ_top_mem:
|
||||
|
@ -383,9 +383,12 @@ static struct {
|
||||
.ns_list = NULL,
|
||||
};
|
||||
|
||||
void free_dns_data(void)
|
||||
void free_dns_data(struct text_object *obj)
|
||||
{
|
||||
int i;
|
||||
|
||||
(void)obj;
|
||||
|
||||
for (i = 0; i < dns_data.nscount; i++)
|
||||
free(dns_data.ns_list[i]);
|
||||
if (dns_data.ns_list)
|
||||
@ -406,7 +409,7 @@ void update_dns_data(void)
|
||||
last_dns_update = current_update_time;
|
||||
*/
|
||||
|
||||
free_dns_data();
|
||||
free_dns_data(NULL);
|
||||
|
||||
if ((fp = fopen("/etc/resolv.conf", "r")) == NULL)
|
||||
return;
|
||||
|
@ -93,7 +93,7 @@ void parse_if_up_arg(struct text_object *, const char *);
|
||||
int interface_up(struct text_object *);
|
||||
void free_if_up(struct text_object *);
|
||||
|
||||
void free_dns_data(void);
|
||||
void free_dns_data(struct text_object *);
|
||||
void update_dns_data(void);
|
||||
void parse_nameserver_arg(struct text_object *, const char *);
|
||||
void print_nameserver(struct text_object *, char *, int);
|
||||
|
Loading…
Reference in New Issue
Block a user