Ejemplo n.º 1
0
/*
 * Deallocate the memory used for the given curses form and all of the
 * widgets it contains.  Note that this only frees any data at the form's
 * userdata pointer IFF cleanup is non-zero.  Also, it does not cause the
 * screen to be refreshed - call curses_form_refresh(NULL) afterwards to
 * make the form disappear.
 */
void
curses_form_free(struct curses_form *cf)
{
	struct curses_widget *w, *t;

	w = cf->widget_head;
	while (w != NULL) {
		t = w->next;
		curses_widget_free(w);
		w = t;
	}

	if (cf->help_text != NULL) {
		free(cf->help_text);
	}

	if (cf->cleanup && cf->userdata != NULL) {
		free(cf->userdata);
	}

	if (cf->win != NULL) {
		del_panel(cf->pan);
		delwin(cf->win);
	}

	free(cf->title);
	AURA_FREE(cf, curses_form);
}
Ejemplo n.º 2
0
/*
 * Free the memory allocated for a queue of commands.  This invalidates
 * the pointer passed to it.
 */
void
commands_free(struct commands *cmds)
{
	struct command *cmd, *next;

	cmd = cmds->head;
	while (cmd != NULL) {
		next = cmd->next;
		if (cmd->cmdline != NULL)
			free(cmd->cmdline);
		if (cmd->desc != NULL)
			free(cmd->desc);
		if (cmd->tag != NULL)
			free(cmd->tag);
		AURA_FREE(cmd, command);
		cmd = next;
	}
	AURA_FREE(cmds, commands);
}
Ejemplo n.º 3
0
struct curses_bar *
curses_bar_new(unsigned int x, unsigned int y,
		unsigned int width, unsigned int height,
		int colors, int flags)
{
	struct curses_bar *b;

	AURA_MALLOC(b, curses_bar);

	if (flags & CURSES_BAR_WIDEN)
		width = xmax;
	if (flags & CURSES_BAR_BOTTOM)
		y = ymax - 1;

	b->x = x;
	b->y = y;
	b->width = width;
	b->height = height;
	b->colors = colors;

	if ((b->win = newwin(height, width, y, x)) == NULL) {
		AURA_FREE(b, curses_bar);
		return(NULL);
	}

	curses_colors_set(b->win, colors);
	curses_window_blank(b->win);

	if ((b->pan = new_panel(b->win)) == NULL) {
		delwin(b->win);
		AURA_FREE(b, curses_bar);
		return(NULL);
	}

	return(b);
}
Ejemplo n.º 4
0
void
curses_bar_free(struct curses_bar *b)
{
	if (b != NULL) {
		if (b->pan != NULL) {
			del_panel(b->pan);
			if (b->win != NULL) {
				delwin(b->win);
			}
		}
		AURA_FREE(b, curses_bar);
	}

	update_panels();
	doupdate();
}
Ejemplo n.º 5
0
void
i_fn_args_free(struct i_fn_args *a)
{
	if (a != NULL) {
		if (a->temp_files != NULL) {
			temp_files_clean(a);
			aura_dict_free(a->temp_files);
		}
		if (a->cmd_names != NULL) {
			config_vars_free(a->cmd_names);
		}
		if (a->s != NULL) {
			storage_free(a->s);
		}
		if (a->c != NULL) {
			dfui_be_stop(a->c);
		}
		if (a->log != NULL) {
			fclose(a->log);
		}
		AURA_FREE(a, i_fn_args);
	}
}