+2002-11-06 Martin M. Hunt <hunt@redhat.com>
+
+ * generic/gdbtk-varobj.c: Remove FREEIF and replace with xfree.
+ Make format_string static.
+
+ (variable_update): Return an object
+ with "-1" in it on error.
+
2002-11-06 Keith Seitz <keiths@redhat.com>
* generic/gdbtk-hooks.c (gdbtk_call_command): Make a null
static void uninstall_variable (Tcl_Interp *, char *);
/* String representations of gdb's format codes */
-char *format_string[] =
+static char *format_string[] =
{"natural", "binary", "decimal", "hexadecimal", "octal"};
\f
-#if defined(FREEIF)
-#undef FREEIF
-#endif
-#define FREEIF(x) if (x != NULL) free((char *) (x))
/* Initialize the variable code. This function should be called once
to install and initialize the variable code into the interpreter. */
{
char *name = varobj_get_expression (var);
Tcl_SetObjResult (interp, Tcl_NewStringObj (name, -1));
- FREEIF (name);
+ xfree (name);
}
break;
case VARIABLE_EDITABLE:
- Tcl_SetObjResult (interp, Tcl_NewIntObj (
- varobj_get_attributes (var) & 0x00000001 /* Editable? */ ));
+ Tcl_SetObjResult (interp,
+ Tcl_NewIntObj (varobj_get_attributes (var) & 0x00000001 /* Editable? */ ));
break;
case VARIABLE_UPDATE:
if (Tcl_GetIndexFromObj (interp, objv[0], create_options, "options",
0, &index) != TCL_OK)
{
- free (obj_name);
+ xfree (obj_name);
result_ptr->flags |= GDBTK_IN_TCL_RESULT;
return TCL_ERROR;
}
Tcl_SetObjResult (interp, Tcl_NewStringObj (obj_name, -1));
result_ptr->flags |= GDBTK_IN_TCL_RESULT;
- free (obj_name);
+ xfree (obj_name);
return TCL_OK;
}
- free (obj_name);
+ xfree (obj_name);
return TCL_ERROR;
}
while (*vc != NULL)
{
uninstall_variable (interp, *vc);
- free (*vc);
+ xfree (*vc);
vc++;
}
- FREEIF (dellist);
+ xfree (dellist);
}
/* Return a list of all the children of VAR, creating them if necessary. */
vc++;
}
- FREEIF (childlist);
+ xfree (childlist);
return list;
}
struct varobj **changelist;
struct varobj **vc;
- changed = Tcl_NewListObj (0, NULL);
-
/* varobj_update() can return -1 if the variable is no longer around,
i.e. we stepped out of the frame in which a local existed. */
if (varobj_update (var, &changelist) == -1)
- return changed;
+ return Tcl_NewStringObj ("-1", -1);
+ changed = Tcl_NewListObj (0, NULL);
vc = changelist;
while (*vc != NULL)
{
vc++;
}
- FREEIF (changelist);
+ xfree (changelist);
return changed;
}
}
Tcl_SetObjResult (interp, Tcl_NewStringObj (string, -1));
- FREEIF (string);
+ xfree (string);
return TCL_OK;
}
else
{
Tcl_SetObjResult (interp, Tcl_NewStringObj (r, -1));
- FREEIF (r);
+ xfree (r);
return TCL_OK;
}
}