Example #1
0
/* This recursively calls free_widget_value() on the tree of widgets.
   It must free all data that was malloc'ed for these widget_values.

   It used to be that emacs only allocated new storage for the `key' slot.
   All other slots are pointers into the data of Lisp_Strings, and must be
   left alone.  */
void free_popup_widget_value_tree(widget_value * wv)
{
	if (!wv) {
		return;
	}
	if (wv->key) {
		/* we mustnt free this? */
#if !defined HAVE_BDWGC || !defined EF_USE_BDWGC
		xfree(wv->key);
#endif	/* !BDWGC */
	}
	if (wv->value) {
		/* we mustnt free this? */
#if !defined HAVE_BDWGC || !defined EF_USE_BDWGC
		xfree(wv->value);
#endif	/* !BDWGC */
	}
	if (wv->name) {
		/* we mustnt free this? */
#if !defined HAVE_BDWGC || !defined EF_USE_BDWGC
		xfree(wv->name);
#endif	/* !BDWGC */
	}

#if defined HAVE_BDWGC && defined EF_USE_BDWGC
	wv->name = wv->value = wv->key = NULL;
#else  /* !BDWGC */
	wv->name = wv->value = wv->key = (char *)0xDEADBEEF;
#endif	/* BDWGC */

	if (wv->contents && (wv->contents != (widget_value *) 1)) {
		free_popup_widget_value_tree(wv->contents);
#if defined HAVE_BDWGC && defined EF_USE_BDWGC
		wv->contents = NULL;
#else  /* !BDWGC */
		wv->contents = (widget_value *) 0xDEADBEEF;
#endif	/* BDWGC */
	}
	if (wv->next) {
		free_popup_widget_value_tree(wv->next);
#if defined HAVE_BDWGC && defined EF_USE_BDWGC
		wv->next = NULL;
#else  /* !BDWGC */
		wv->next = (widget_value *) 0xDEADBEEF;
#endif	/* BDWGC */
	}
	free_widget_value(wv);
	return;
}
Example #2
0
/* This recursively calls free_widget_value() on the tree of widgets.
   It must free all data that was malloc'ed for these widget_values.

   It used to be that emacs only allocated new storage for the `key' slot.
   All other slots are pointers into the data of Lisp_Strings, and must be
   left alone.  */
void
free_popup_widget_value_tree (widget_value *wv)
{
  if (! wv) return;
  if (wv->key) xfree (wv->key);
  if (wv->value) xfree (wv->value);
  if (wv->name) xfree (wv->name);

  wv->name = wv->value = wv->key = (char *) 0xDEADBEEF;

  if (wv->contents && (wv->contents != (widget_value*)1))
    {
      free_popup_widget_value_tree (wv->contents);
      wv->contents = (widget_value *) 0xDEADBEEF;
    }
  if (wv->next)
    {
      free_popup_widget_value_tree (wv->next);
      wv->next = (widget_value *) 0xDEADBEEF;
    }
  free_widget_value (wv);
}