Remove most uses of ALL_OBJFILES
[deliverable/binutils-gdb.git] / gdb / python / py-prettyprint.c
index ac0506f3e11eeb56be9252dd8ca481778d264bb8..4092fdb79f3e9a0a71b9c3a9d14a9d88a812385a 100644 (file)
@@ -93,28 +93,26 @@ search_pp_list (PyObject *list, PyObject *value)
 static PyObject *
 find_pretty_printer_from_objfiles (PyObject *value)
 {
-  struct objfile *obj;
+  for (objfile *obj : all_objfiles (current_program_space))
+    {
+      gdbpy_ref<> objf = objfile_to_objfile_object (obj);
+      if (objf == NULL)
+       {
+         /* Ignore the error and continue.  */
+         PyErr_Clear ();
+         continue;
+       }
 
-  ALL_OBJFILES (obj)
-  {
-    gdbpy_ref<> objf = objfile_to_objfile_object (obj);
-    if (objf == NULL)
-      {
-       /* Ignore the error and continue.  */
-       PyErr_Clear ();
-       continue;
-      }
-
-    gdbpy_ref<> pp_list (objfpy_get_printers (objf.get (), NULL));
-    gdbpy_ref<> function (search_pp_list (pp_list.get (), value));
-
-    /* If there is an error in any objfile list, abort the search and exit.  */
-    if (function == NULL)
-      return NULL;
+      gdbpy_ref<> pp_list (objfpy_get_printers (objf.get (), NULL));
+      gdbpy_ref<> function (search_pp_list (pp_list.get (), value));
 
-    if (function != Py_None)
-      return function.release ();
-  }
+      /* If there is an error in any objfile list, abort the search and exit.  */
+      if (function == NULL)
+       return NULL;
+
+      if (function != Py_None)
+       return function.release ();
+    }
 
   Py_RETURN_NONE;
 }
This page took 0.024479 seconds and 4 git commands to generate.