* breakpoint.c (add_catch_command): Use completer_ftype.
[deliverable/binutils-gdb.git] / gdb / python / py-cmd.c
index 677c1e416e09dfc570f73f10dd96fb6a3d59e465..605c8c002eb797d939648b0045e0d01e649b5bd6 100644 (file)
@@ -1,6 +1,6 @@
 /* gdb commands implemented in Python
 
-   Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -35,7 +35,7 @@ struct cmdpy_completer
   /* Python symbol name.  */
   char *name;
   /* Completion function.  */
-  char **(*completer) (struct cmd_list_element *, char *, char *);
+  completer_ftype *completer;
 };
 
 static struct cmdpy_completer completers[] =
@@ -436,7 +436,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
       && cmdtype != class_files && cmdtype != class_support
       && cmdtype != class_info && cmdtype != class_breakpoint
       && cmdtype != class_trace && cmdtype != class_obscure
-      && cmdtype != class_maintenance)
+      && cmdtype != class_maintenance && cmdtype != class_user)
     {
       PyErr_Format (PyExc_RuntimeError, _("Invalid command class argument."));
       return -1;
@@ -578,7 +578,8 @@ gdbpy_initialize_commands (void)
       || PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE",
                                  class_obscure) < 0
       || PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
-                                 class_maintenance) < 0)
+                                 class_maintenance) < 0
+      || PyModule_AddIntConstant (gdb_module, "COMMAND_USER", class_user) < 0)
     return;
 
   for (i = 0; i < N_COMPLETERS; ++i)
@@ -683,14 +684,12 @@ gdbpy_string_to_argv (PyObject *self, PyObject *args)
          if (argp == NULL
              || PyList_Append (py_argv, argp) < 0)
            {
-             if (argp != NULL)
-               {
-                 Py_DECREF (argp);
-               }
+             Py_XDECREF (argp);
              Py_DECREF (py_argv);
              freeargv (c_argv);
              return NULL;
            }
+         Py_DECREF (argp);
        }
 
       freeargv (c_argv);
This page took 0.024553 seconds and 4 git commands to generate.