summaryrefslogtreecommitdiff
path: root/gdb/dwarf-index-write.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-09-14 11:28:45 -0600
committerTom Tromey <tom@tromey.com>2018-10-27 11:58:40 -0600
commit29be4d9dee1263b36e33421dd8ea69b9b7308391 (patch)
tree17db04186271dfff6b2816d044bf23672687a66f /gdb/dwarf-index-write.c
parent974e68446388769f023c6c9bfb1e67ed75199618 (diff)
downloadbinutils-gdb-29be4d9dee1263b36e33421dd8ea69b9b7308391.tar.gz
Move make_temp_filename to common/pathstuff.c
Currently make_temp_filename is a function local to write_psymtabs_to_index. This patch moves it to pathstuff.c so that it can be used from other places in gdb. gdb/ChangeLog 2018-10-27 Tom Tromey <tom@tromey.com> * dwarf-index-write.c (write_psymtabs_to_index): Move make_temp_filename to common/pathstuff.c. * common/pathstuff.h (make_temp_filename): Declare. * common/pathstuff.c (make_temp_filename): New function, moved from dwarf-index-write.c.
Diffstat (limited to 'gdb/dwarf-index-write.c')
-rw-r--r--gdb/dwarf-index-write.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/gdb/dwarf-index-write.c b/gdb/dwarf-index-write.c
index d4585af837c..4335c39074f 100644
--- a/gdb/dwarf-index-write.c
+++ b/gdb/dwarf-index-write.c
@@ -24,6 +24,7 @@
#include "common/byte-vector.h"
#include "common/filestuff.h"
#include "common/gdb_unlinker.h"
+#include "common/pathstuff.h"
#include "common/scoped_fd.h"
#include "complaints.h"
#include "dwarf-index-common.h"
@@ -1560,16 +1561,6 @@ write_psymtabs_to_index (struct dwarf2_per_objfile *dwarf2_per_objfile,
if (stat (objfile_name (objfile), &st) < 0)
perror_with_name (objfile_name (objfile));
- /* Make a filename suitable to pass to mkstemp based on F (e.g.
- /tmp/foo -> /tmp/foo-XXXXXX). */
- auto make_temp_filename = [] (const std::string &f) -> gdb::char_vector
- {
- gdb::char_vector filename_temp (f.length () + 8);
- strcpy (filename_temp.data (), f.c_str ());
- strcat (filename_temp.data () + f.size (), "-XXXXXX");
- return filename_temp;
- };
-
std::string filename (std::string (dir) + SLASH_STRING + basename
+ (index_kind == dw_index_kind::DEBUG_NAMES
? INDEX5_SUFFIX : INDEX4_SUFFIX));