Constify argument to make_tempname and make_tempdir
authorTom Tromey <tom@tromey.com>
Sun, 8 Sep 2019 15:53:43 +0000 (09:53 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 11 Sep 2019 13:02:46 +0000 (07:02 -0600)
This constifies the argument to make_tempname and make_tempdir,
removing some casts.

I initially thought that this obsoleted the allocation in
write_archive, but write_archive closes the BFD before using the name,
so this appears not to be the case.

binutils/ChangeLog
2019-09-11  Tom Tromey  <tom@tromey.com>

* objcopy.c (copy_archive): Update.
* bucomm.h (make_tempname, make_tempdir): Make argument const.
* bucomm.c (make_tempname, make_tempdir): Make argument const.

binutils/ChangeLog
binutils/bucomm.c
binutils/bucomm.h
binutils/objcopy.c

index 2e41773d878c32f92c947456d3024bb3875cb744..8b78873a992d3ac70b1f342e8683e2b10cc9ee14 100644 (file)
@@ -1,3 +1,9 @@
+2019-09-11  Tom Tromey  <tom@tromey.com>
+
+       * objcopy.c (copy_archive): Update.
+       * bucomm.h (make_tempname, make_tempdir): Make argument const.
+       * bucomm.c (make_tempname, make_tempdir): Make argument const.
+
 2019-09-11  Alan Modra  <amodra@gmail.com>
 
        PR 24907
index 21adb05c4188556de5273df9088c9dc6d4b3fc8b..e8ac3b6de85e0d50fbf1ca4272c85bddb2500f1c 100644 (file)
@@ -532,7 +532,7 @@ template_in_dir (const char *path)
    as FILENAME.  */
 
 char *
-make_tempname (char *filename)
+make_tempname (const char *filename)
 {
   char *tmpname = template_in_dir (filename);
   int fd;
@@ -558,7 +558,7 @@ make_tempname (char *filename)
    directory containing FILENAME.  */
 
 char *
-make_tempdir (char *filename)
+make_tempdir (const char *filename)
 {
   char *tmpname = template_in_dir (filename);
 
index 4ab96bcf862ac4ab50e2efd66ab2defd826553a2..35c8cd357def172c26459bb0d42f508ff9719bd0 100644 (file)
@@ -51,8 +51,8 @@ int display_info (void);
 
 void print_arelt_descr (FILE *, bfd *, bfd_boolean, bfd_boolean);
 
-char *make_tempname (char *);
-char *make_tempdir (char *);
+char *make_tempname (const char *);
+char *make_tempdir (const char *);
 
 bfd_vma parse_vma (const char *, const char *);
 
index b702e52d987a260afe419bf27cd66dd8c45689d5..ebb99339aaa8023ca360e566be8a994947e6ea49 100644 (file)
@@ -3311,7 +3311,7 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
     }
 
   /* Make a temp directory to hold the contents.  */
-  dir = make_tempdir ((char *) bfd_get_filename (obfd));
+  dir = make_tempdir (bfd_get_filename (obfd));
   if (dir == NULL)
     fatal (_("cannot create tempdir for archive copying (error: %s)"),
           strerror (errno));
This page took 0.055421 seconds and 4 git commands to generate.