static int fnpy_init (PyObject *self, PyObject *args, PyObject *kwds) { const char *name; gdb::unique_xmalloc_ptr<char> docstring; if (! PyArg_ParseTuple (args, "s", &name)) return -1; Py_INCREF (self); if (PyObject_HasAttrString (self, "__doc__")) { gdbpy_ref<> ds_obj (PyObject_GetAttrString (self, "__doc__")); if (ds_obj != NULL) { if (gdbpy_is_string (ds_obj.get ())) { docstring = python_string_to_host_string (ds_obj.get ()); if (docstring == NULL) { Py_DECREF (self); return -1; } } } } if (! docstring) docstring.reset (xstrdup (_("This function is not documented."))); add_internal_function (name, docstring.release (), fnpy_call, self); return 0; }
static int fnpy_init (PyObject *self, PyObject *args, PyObject *kwds) { const char *name; char *docstring = NULL; if (! PyArg_ParseTuple (args, "s", &name)) return -1; Py_INCREF (self); if (PyObject_HasAttrString (self, "__doc__")) { PyObject *ds_obj = PyObject_GetAttrString (self, "__doc__"); if (ds_obj != NULL) { if (gdbpy_is_string (ds_obj)) { docstring = python_string_to_host_string (ds_obj); if (docstring == NULL) { Py_DECREF (self); Py_DECREF (ds_obj); return -1; } } Py_DECREF (ds_obj); } } if (! docstring) docstring = xstrdup (_("This function is not documented.")); add_internal_function (name, docstring, fnpy_call, self); return 0; }