Handle var_zuinteger and var_zuinteger_unlimited from Python
[deliverable/binutils-gdb.git] / gdb / inf-child.c
index 6875596f33677ddd06aeffc19ed3349858652f97..c7c45530b6bc38a54e60c55e258ec0c3ac2e4ee7 100644 (file)
@@ -333,7 +333,7 @@ inf_child_fileio_unlink (struct target_ops *self,
 
 /* Implementation of to_fileio_readlink.  */
 
-static char *
+static gdb::optional<std::string>
 inf_child_fileio_readlink (struct target_ops *self,
                           struct inferior *inf, const char *filename,
                           int *target_errno)
@@ -343,22 +343,18 @@ inf_child_fileio_readlink (struct target_ops *self,
 #if defined (PATH_MAX)
   char buf[PATH_MAX];
   int len;
-  char *ret;
 
   len = readlink (filename, buf, sizeof buf);
   if (len < 0)
     {
       *target_errno = host_to_fileio_error (errno);
-      return NULL;
+      return {};
     }
 
-  ret = (char *) xmalloc (len + 1);
-  memcpy (ret, buf, len);
-  ret[len] = '\0';
-  return ret;
+  return std::string (buf, len);
 #else
   *target_errno = FILEIO_ENOSYS;
-  return NULL;
+  return {};
 #endif
 }
 
This page took 0.02414 seconds and 4 git commands to generate.