Revert call to bfd_cache_close().
[deliverable/binutils-gdb.git] / gdb / varobj.c
index 799558b844509097fca60eb66ddde586774c6793..40bc209de3ef0eb14a664c44738d7e3d24f460d2 100644 (file)
@@ -1,5 +1,5 @@
 /* Implementation of the GDB variable objects API.
-   Copyright 1999, 2000 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,7 +20,6 @@
 #include "value.h"
 #include "expression.h"
 #include "frame.h"
-#include "valprint.h"
 #include "language.h"
 #include "wrapper.h"
 #include "gdbcmd.h"
@@ -391,11 +390,6 @@ static int rootcount = 0;  /* number of root varobjs in the list */
 /* Pointer to the varobj hash table (built at run time) */
 static struct vlist **varobj_table;
 
-#if defined(FREEIF)
-#undef FREEIF
-#endif
-#define FREEIF(x) if (x != NULL) free((char *) (x))
-
 /* Is the variable X one of our "fake" children? */
 #define CPLUS_FAKE_CHILD(x) \
 ((x) != NULL && (x)->type == NULL && (x)->value == NULL)
@@ -411,7 +405,8 @@ varobj_create (char *objname,
               enum varobj_type type)
 {
   struct varobj *var;
-  struct frame_info *fi, *old_fi;
+  struct frame_info *fi;
+  struct frame_info *old_fi = NULL;
   struct block *block;
   struct cleanup *old_chain;
 
@@ -787,7 +782,7 @@ varobj_set_value (struct varobj *var, char *expression)
       if (!gdb_evaluate_expression (exp, &value))
        {
          /* We cannot proceed without a valid expression. */
-         FREEIF (exp);
+         xfree (exp);
          return 0;
        }
 
@@ -883,7 +878,7 @@ varobj_update (struct varobj *var, struct varobj ***changelist)
   int error2;
   struct varobj *v;
   struct varobj **cv;
-  struct varobj **templist;
+  struct varobj **templist = NULL;
   value_ptr new;
   struct vstack *stack = NULL;
   struct vstack *result = NULL;
@@ -1064,7 +1059,7 @@ delete_variable_1 (struct cpstack **resultp, int *delcountp, struct varobj *var,
        vc->child->parent = NULL;
       delete_variable_1 (resultp, delcountp, vc->child, 0, only_children_p);
       next = vc->next;
-      free (vc);
+      xfree (vc);
     }
 
   /* if we were called to delete only the children we are done here */
@@ -1076,7 +1071,7 @@ delete_variable_1 (struct cpstack **resultp, int *delcountp, struct varobj *var,
      yet been installed, don't report it, it belongs to the caller... */
   if (var->obj_name != NULL)
     {
-      cppush (resultp, strdup (var->obj_name));
+      cppush (resultp, xstrdup (var->obj_name));
       *delcountp = *delcountp + 1;
     }
 
@@ -1181,7 +1176,7 @@ uninstall_variable (struct varobj *var)
   else
     prev->next = cv->next;
 
-  free (cv);
+  xfree (cv);
 
   /* If root, remove varobj from root list */
   if (var->root->rootvar == var)
@@ -1352,12 +1347,12 @@ free_variable (struct varobj *var)
   if (var->root->rootvar == var)
     {
       free_current_contents ((char **) &var->root->exp);
-      FREEIF (var->root);
+      xfree (var->root);
     }
 
-  FREEIF (var->name);
-  FREEIF (var->obj_name);
-  FREEIF (var);
+  xfree (var->name);
+  xfree (var->obj_name);
+  xfree (var);
 }
 
 static void
@@ -1506,7 +1501,7 @@ vpop (struct vstack **pstack)
   s = *pstack;
   v = s->var;
   *pstack = (*pstack)->next;
-  free (s);
+  xfree (s);
 
   return v;
 }
@@ -1536,7 +1531,7 @@ cppop (struct cpstack **pstack)
   s = *pstack;
   v = s->name;
   *pstack = (*pstack)->next;
-  free (s);
+  xfree (s);
 
   return v;
 }
This page took 0.024451 seconds and 4 git commands to generate.