-/* Extract and return the actual string from the lazy string object
- STRING. Addtionally, the string type is written to *STR_TYPE, the
- string length is written to *LENGTH, and the string encoding is
- written to *ENCODING. On error, NULL is returned. The caller is
- responsible for freeing the returned buffer. */
-gdb_byte *
-gdbpy_extract_lazy_string (PyObject *string, struct type **str_type,
- long *length, char **encoding)
-{
- int width;
- int bytes_read;
- gdb_byte *buffer = NULL;
- int errcode = 0;
- CORE_ADDR addr;
- struct gdbarch *gdbarch;
- enum bfd_endian byte_order;
- PyObject *py_len = NULL, *py_encoding = NULL;
- PyObject *py_addr = NULL, *py_type = NULL;
- volatile struct gdb_exception except;
-
- py_len = PyObject_GetAttrString (string, "length");
- py_encoding = PyObject_GetAttrString (string, "encoding");
- py_addr = PyObject_GetAttrString (string, "address");
- py_type = PyObject_GetAttrString (string, "type");
-
- /* A NULL encoding, length, address or type is not ok. */
- if (!py_len || !py_encoding || !py_addr || !py_type)
- goto error;
-
- *length = PyLong_AsLong (py_len);
- addr = PyLong_AsUnsignedLongLong (py_addr);
+/* Extract the parameters from the lazy string object STRING.
+ ENCODING will either be set to NULL, or will be allocated with
+ xmalloc, in which case the callers is responsible for freeing
+ it. */