[v12,07/32] Code cleanup: Make solib_find_1 variable const

Message ID 20150821212104.6673.10903.stgit@host1.jankratochvil.net
State New, archived
Headers

Commit Message

Jan Kratochvil Aug. 21, 2015, 9:21 p.m. UTC
  Hi,

it gets used in the next patch.


Jan


2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* solib.c (solib_find_1): Make sysroot variable const.
---
 0 files changed
  

Patch

diff --git a/gdb/solib.c b/gdb/solib.c
index cf78f6a..be31ffd 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -157,7 +157,7 @@  solib_find_1 (char *in_pathname, int *fd, int is_solib)
   char *temp_pathname = NULL;
   const char *fskind = effective_target_file_system_kind ();
   struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
-  char *sysroot = gdb_sysroot;
+  const char *sysroot = gdb_sysroot;
   int prefix_len, orig_prefix_len;
 
   /* If the absolute prefix starts with "target:" but the filesystem
@@ -179,8 +179,10 @@  solib_find_1 (char *in_pathname, int *fd, int is_solib)
     sysroot = NULL;
   else if (prefix_len != orig_prefix_len)
     {
-      sysroot = savestring (sysroot, prefix_len);
-      make_cleanup (xfree, sysroot);
+      char *s = savestring (sysroot, prefix_len);
+
+      make_cleanup (xfree, s);
+      sysroot = s;
     }
 
   /* If we're on a non-DOS-based system, backslashes won't be