Update copyright year range in all GDB files.
[deliverable/binutils-gdb.git] / gdb / python / py-symtab.c
index 9bb20dab31fc345295ca7efd31a251b44f18023f..e4a10dc3c74f4f7e4332ea1183ee9acd509c6b9e 100644 (file)
@@ -1,6 +1,6 @@
 /* Python interface to symbol tables.
 
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -109,7 +109,7 @@ stpy_get_filename (PyObject *self, void *closure)
   STPY_REQUIRE_VALID (self, symtab);
   filename = symtab_to_filename_for_display (symtab);
 
-  str_obj = host_string_to_python_string (filename);
+  str_obj = host_string_to_python_string (filename).release ();
   return str_obj;
 }
 
@@ -137,7 +137,7 @@ stpy_get_producer (PyObject *self, void *closure)
     {
       const char *producer = COMPUNIT_PRODUCER (cust);
 
-      return host_string_to_python_string (producer);
+      return host_string_to_python_string (producer).release ();
     }
 
   Py_RETURN_NONE;
@@ -153,7 +153,7 @@ stpy_fullname (PyObject *self, PyObject *args)
 
   fullname = symtab_to_fullname (symtab);
 
-  return host_string_to_python_string (fullname);
+  return host_string_to_python_string (fullname).release ();
 }
 
 /* Implementation of gdb.Symtab.is_valid (self) -> Boolean.
@@ -220,10 +220,8 @@ stpy_get_linetable (PyObject *self, PyObject *args)
 static PyObject *
 salpy_str (PyObject *self)
 {
-  char *s;
   const char *filename;
   sal_object *sal_obj;
-  PyObject *result;
   struct symtab_and_line *sal = NULL;
 
   SALPY_REQUIRE_VALID (self, sal);
@@ -232,13 +230,8 @@ salpy_str (PyObject *self)
   filename = (sal_obj->symtab == (symtab_object *) Py_None)
     ? "<unknown>" : symtab_to_filename_for_display (sal_obj->symtab->symtab);
 
-  s = xstrprintf ("symbol and line for %s, line %d", filename,
-                 sal->line);
-
-  result = PyString_FromString (s);
-  xfree (s);
-
-  return result;
+  return PyString_FromFormat ("symbol and line for %s, line %d", filename,
+                             sal->line);
 }
 
 static void
This page took 0.027054 seconds and 4 git commands to generate.