This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Constify argument to make_tempname and make_tempdir
- From: Tom Tromey <tromey at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 11 Sep 2019 17:34:27 -0000
- Subject: [binutils-gdb] Constify argument to make_tempname and make_tempdir
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1ff5d5c46342727ad6728732e122f963fbb2268b
commit 1ff5d5c46342727ad6728732e122f963fbb2268b
Author: Tom Tromey <tom@tromey.com>
Date: Sun Sep 8 09:53:43 2019 -0600
Constify argument to make_tempname and make_tempdir
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.
Diff:
---
binutils/ChangeLog | 6 ++++++
binutils/bucomm.c | 4 ++--
binutils/bucomm.h | 4 ++--
binutils/objcopy.c | 2 +-
4 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 2e41773..8b78873 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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
diff --git a/binutils/bucomm.c b/binutils/bucomm.c
index 21adb05..e8ac3b6 100644
--- a/binutils/bucomm.c
+++ b/binutils/bucomm.c
@@ -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);
diff --git a/binutils/bucomm.h b/binutils/bucomm.h
index 4ab96bc..35c8cd3 100644
--- a/binutils/bucomm.h
+++ b/binutils/bucomm.h
@@ -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 *);
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index b702e52..ebb9933 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -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));