*/
#define DO_JUMP { \
DBGP2("jumping"); \
- obj = obj->special_data; \
+ if (obj->ifblock_next) \
+ obj = obj->ifblock_next; \
}
#define OBJ(a) break; case OBJ_##a:
* Do Ninja jump here: without leaving traces.
* This is to prevent us from stale jumped flags.
*/
- obj = obj->special_data;
+ obj = obj->ifblock_next;
continue;
}
OBJ(endif) {
void free_text_objects(struct text_object *root, int internal)
{
struct text_object *obj;
- char type_is_if;
if (!root->prev) {
return;
break;
#endif /* X11 */
}
- type_is_if = 0;
- if(obj->type == OBJ_if_gw || obj->type == OBJ_if_empty || obj->type == OBJ_if_match || obj->type == OBJ_if_existing || obj->type == OBJ_if_mounted || obj->type == OBJ_if_running || obj->type == OBJ_if_updatenr || obj->type == OBJ_if_mixer_mute) type_is_if = 1;
-#if defined(IBM)
- if(obj->type == OBJ_if_smapi_bat_installed) type_is_if = 1;
-#endif
-#if defined(__FreeBSD__) || defined(__linux__)
- if(obj->type == OBJ_if_up) type_is_if = 1;
-#endif
-#ifdef MPD
- if(obj->type == OBJ_if_mpd_playing) type_is_if = 1;
-#endif
-#ifdef XMMS2
- if(obj->type == OBJ_if_xmms2_connected) type_is_if = 1;
-#endif
- if(obj->special_data && obj->type != OBJ_else && type_is_if == 0) free(obj->special_data);
+ if(obj->special_data)
+ free(obj->special_data);
free(obj);
}
#undef data
case IFBLOCK_ENDIF:
if (!(*ifblock_stack_top))
CRIT_ERR(NULL, NULL, "got an endif without matching if");
- (*ifblock_stack_top)->obj->special_data = obj;
+ (*ifblock_stack_top)->obj->ifblock_next = obj;
/* if there's some else in between, remove and free it */
if ((*ifblock_stack_top)->type == IFBLOCK_ELSE) {
stackobj = *ifblock_stack_top;
case IFBLOCK_ELSE:
if (!(*ifblock_stack_top))
CRIT_ERR(NULL, NULL, "got an else without matching if");
- (*ifblock_stack_top)->obj->special_data = obj;
+ (*ifblock_stack_top)->obj->ifblock_next = obj;
/* fall through */
case IFBLOCK_IF:
stackobj = malloc(sizeof(struct ifblock_stack_obj));
struct text_object {
struct text_object *next, *prev; /* doubly linked list of text objects */
struct text_object *sub; /* for objects parsing text into objects */
+ struct text_object *ifblock_next; /* jump target for ifblock objects */
union {
void *opaque; /* new style generic per object data */
char *s; /* some string */