This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/6] Code cleanup: dwarf2read.c: Eliminate ::file_write
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 17 Jun 2017 19:34:43 +0200
- Subject: Re: [PATCH 2/6] Code cleanup: dwarf2read.c: Eliminate ::file_write
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jan dot kratochvil at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 21F07C04B317
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 21F07C04B317
- References: <8efc0742-1014-4fe0-6948-f40a9c5c4975@redhat.com> <1497284051-13795-2-git-send-email-palves@redhat.com>
On Mon, 12 Jun 2017 18:14:07 +0200, Pedro Alves wrote:
> There's no real need for all this indirection.
> - ::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"));
Aren't 28 characters with the variable mentioned once easier to write and more
bug-proof than to write each time 115 characters mentioning the same variable
3 times?
Jan