mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 02:55:12 +00:00
drop useless ifblock.str
This commit is contained in:
parent
66c187e7a1
commit
9a770295d1
15
src/conky.c
15
src/conky.c
@ -1414,13 +1414,16 @@ void generate_text_internal(char *p, int p_max_size,
|
||||
free(tmp_info);
|
||||
}
|
||||
OBJ(if_existing) {
|
||||
if (obj->data.ifblock.str
|
||||
&& !check_contains(obj->data.ifblock.s,
|
||||
obj->data.ifblock.str)) {
|
||||
DO_JUMP;
|
||||
} else if (obj->data.ifblock.s
|
||||
&& access(obj->data.ifblock.s, F_OK)) {
|
||||
char *spc;
|
||||
|
||||
spc = strchr(obj->data.ifblock.s, ' ');
|
||||
if (!spc && access(obj->data.ifblock.s, F_OK)) {
|
||||
DO_JUMP;
|
||||
} else if (spc) {
|
||||
*spc = '\0';
|
||||
if (check_contains(obj->data.ifblock.s, spc + 1))
|
||||
DO_JUMP;
|
||||
*spc = ' ';
|
||||
}
|
||||
}
|
||||
OBJ(if_mounted) {
|
||||
|
15
src/core.c
15
src/core.c
@ -557,17 +557,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
obj->sub = malloc(sizeof(struct text_object));
|
||||
extract_variable_text_internal(obj->sub, arg);
|
||||
END OBJ_IF_ARG(if_existing, 0, "if_existing needs an argument or two")
|
||||
char buf1[256], buf2[256];
|
||||
int r = sscanf(arg, "%255s %255[^\n]", buf1, buf2);
|
||||
|
||||
if (r == 1) {
|
||||
obj->data.ifblock.s = strndup(buf1, text_buffer_size);
|
||||
obj->data.ifblock.str = NULL;
|
||||
} else {
|
||||
obj->data.ifblock.s = strndup(buf1, text_buffer_size);
|
||||
obj->data.ifblock.str = strndup(buf2, text_buffer_size);
|
||||
}
|
||||
DBGP("if_existing: '%s' '%s'", obj->data.ifblock.s, obj->data.ifblock.str);
|
||||
obj->data.ifblock.s = strndup(arg, text_buffer_size);
|
||||
END OBJ_IF_ARG(if_mounted, 0, "if_mounted needs an argument")
|
||||
obj->data.ifblock.s = strndup(arg, text_buffer_size);
|
||||
#ifdef __linux__
|
||||
@ -1284,7 +1274,6 @@ void free_text_objects(struct text_object *root, int internal)
|
||||
case OBJ_if_mounted:
|
||||
case OBJ_if_running:
|
||||
free(data.ifblock.s);
|
||||
free(data.ifblock.str);
|
||||
break;
|
||||
case OBJ_head:
|
||||
case OBJ_tail:
|
||||
@ -1314,7 +1303,6 @@ void free_text_objects(struct text_object *root, int internal)
|
||||
break;
|
||||
case OBJ_if_gw:
|
||||
free(data.ifblock.s);
|
||||
free(data.ifblock.str);
|
||||
case OBJ_gw_iface:
|
||||
case OBJ_gw_ip:
|
||||
free_gateway_info();
|
||||
@ -1519,7 +1507,6 @@ void free_text_objects(struct text_object *root, int internal)
|
||||
break;
|
||||
case OBJ_if_smapi_bat_installed:
|
||||
free(data.ifblock.s);
|
||||
free(data.ifblock.str);
|
||||
break;
|
||||
#endif /* IBM */
|
||||
#ifdef NVIDIA
|
||||
|
@ -441,7 +441,6 @@ struct text_object {
|
||||
struct text_object *next;
|
||||
char *s;
|
||||
int i;
|
||||
char *str;
|
||||
} ifblock;
|
||||
} data;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user