diff options
author | Pedro Alves <palves@redhat.com> | 2017-06-10 00:53:00 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-06-12 17:06:25 +0100 |
commit | a81e6d4d261b7471428408f4ebba1b8113c16ccf (patch) | |
tree | e4bde487e60b73158bad804a8f4cf7e625edaa01 /gdb/dwarf2read.c | |
parent | 6fd931f2d66af8398b2fae3ab5f5afe091b8362f (diff) | |
download | gdb-a81e6d4d261b7471428408f4ebba1b8113c16ccf.zip gdb-a81e6d4d261b7471428408f4ebba1b8113c16ccf.tar.gz gdb-a81e6d4d261b7471428408f4ebba1b8113c16ccf.tar.bz2 |
Code cleanup: dwarf2read.c: Eliminate ::file_write
There's no real need for all this indirection.
gdb/ChangeLog:
2017-06-12 Pedro Alves <palves@redhat.com>
* dwarf2read.c (file_write(FILE *, const void *, size_t)): Delete.
(file_write (FILE *, const std::vector<Elem>&)): Delete.
(data_buf::file_write): Call ::fwrite directly.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 0c9e275..55b3033 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -23195,25 +23195,6 @@ dwarf2_per_objfile_free (struct objfile *objfile, void *d) /* The "save gdb-index" command. */ -/* Write SIZE bytes from the buffer pointed to by DATA to FILE, with - error checking. */ - -static void -file_write (FILE *file, const void *data, size_t size) -{ - if (fwrite (data, 1, size, file) != size) - error (_("couldn't data write to file")); -} - -/* Write the contents of VEC to FILE, with error checking. */ - -template<class Elem> -static void -file_write (FILE *file, const std::vector<Elem> &vec) -{ - file_write (file, vec.data (), vec.size() * sizeof (vec[0])); -} - /* In-memory buffer to prepare data to be written later to a file. */ class data_buf { @@ -23252,7 +23233,8 @@ public: /* Write the buffer to FILE. */ void file_write (FILE *file) const { - ::file_write (file, m_vec); + if (::fwrite (m_vec.data (), 1, m_vec.size (), file) != m_vec.size ()) + error (_("couldn't write data to file")); } private: |