linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Tulak <jtulak@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: Jan Tulak <jtulak@redhat.com>
Subject: [PATCH 02/24] xfsdump: do not split function call with ifdef
Date: Fri,  9 Nov 2018 15:29:42 +0100	[thread overview]
Message-ID: <20181109143004.24963-3-jtulak@redhat.com> (raw)
In-Reply-To: <20181109143004.24963-1-jtulak@redhat.com>

In two files in xfsdump, a function call is split in half by an ifdef
macro to conditionally pick an argument at compile time. This causes the
code to be a bit less obvious and some analysis tools have trouble with
understanding it.

So, instead of splitting the function in half, move the whole function
call into each of the ifdef macros.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
---
 common/drive_minrmt.c | 3 ++-
 common/main.c         | 8 ++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/common/drive_minrmt.c b/common/drive_minrmt.c
index 59a40a7..04fed3e 100644
--- a/common/drive_minrmt.c
+++ b/common/drive_minrmt.c
@@ -2585,11 +2585,12 @@ read_label( drive_t *drivep )
 	if (( nread == 0 )  /* takes care of sun */
 	      ||            /* now handle SGI */
 	      (nread < 0 && saved_errno == ENOSPC )) {
-		mlog( MLOG_NORMAL | MLOG_DRIVE,
 #ifdef DUMP
+		mlog( MLOG_NORMAL | MLOG_DRIVE,
 		      _("encountered EOD : assuming blank media\n") );
 #endif
 #ifdef RESTORE
+		mlog( MLOG_NORMAL | MLOG_DRIVE,
 		      _("encountered EOD : end of data\n") );
 #endif
 		( void )rewind_and_verify( drivep );
diff --git a/common/main.c b/common/main.c
index b3605d1..0c23eb4 100644
--- a/common/main.c
+++ b/common/main.c
@@ -581,12 +581,14 @@ main( int argc, char *argv[] )
 		sigaction( SIGTERM, &sa, NULL );
 		sigaction( SIGQUIT, &sa, NULL );
 
+#ifdef DUMP
 		ok = drive_init2( argc,
 				  argv,
-#ifdef DUMP
 				  gwhdrtemplatep );
 #endif /* DUMP */
 #ifdef RESTORE
+		ok = drive_init2( argc,
+				  argv,
 				  ( global_hdr_t * )0 );
 #endif /* RESTORE */
 		if ( ! ok ) {
@@ -629,12 +631,14 @@ main( int argc, char *argv[] )
 	 * time-consuming chore. drive_init3 will synchronize with each slave.
 	 */
 	if ( ! init_error ) {
+#ifdef DUMP
 		ok = drive_init2( argc,
 				  argv,
-#ifdef DUMP
 				  gwhdrtemplatep );
 #endif /* DUMP */
 #ifdef RESTORE
+		ok = drive_init2( argc,
+				  argv,
 				  ( global_hdr_t * )0 );
 #endif /* RESTORE */
 		if ( ! ok ) {
-- 
2.19.1

  parent reply	other threads:[~2018-11-10  0:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09 14:29 [PATCH 00/24] xfsdump: code style change Jan Tulak
2018-11-09 14:29 ` [PATCH 01/24] xfsdump: (style) remove trailing whitespaces Jan Tulak
2018-11-09 14:29 ` Jan Tulak [this message]
2018-11-09 14:29 ` [PATCH 04/24] xfsdump: (2/4)(style) remove spaces from parentheses Jan Tulak
2018-11-09 14:29 ` [PATCH 06/24] xfsdump: (4/4)(style) " Jan Tulak
2018-11-09 14:29 ` [PATCH 07/24] xfsdump: (style) remove a space in front of comma/semicolon Jan Tulak
2018-11-09 14:29 ` [PATCH 08/24] xfsdump: (style) remove a space in ptr dereferences Jan Tulak
2018-11-09 14:29 ` [PATCH 09/24] xfsdump: add a space after comma and semicolon where was none Jan Tulak
2018-11-09 14:29 ` [PATCH 10/24] xfsdump: (style) insert a newline between type and fnt name in definitions Jan Tulak
2018-11-09 14:29 ` [PATCH 11/24] xfsdump: (style) add a space after if, switch, for, do, while Jan Tulak
2018-11-09 14:29 ` [PATCH 13/24] xfsdump: (2/4)(style) add first empty line for multiline comments Jan Tulak
2018-11-09 14:29 ` [PATCH 14/24] xfsdump: (3/4)(style) " Jan Tulak
2018-11-09 14:29 ` [PATCH 15/24] xfsdump: (4/4)(style) " Jan Tulak
2018-11-09 14:29 ` [PATCH 16/24] xfsdump: (style) curly brackets should wrap with one space Jan Tulak
2018-11-09 14:29 ` [PATCH 18/24] xfsdump: (2/4)(style) indent and align the code Jan Tulak
2018-11-09 14:30 ` [PATCH 21/24] xfsdump: (style) format intercharacter spaces Jan Tulak
2018-11-09 14:30 ` [PATCH 22/24] xfsdump: (style) format newlines Jan Tulak
2018-11-09 14:30 ` [PATCH 23/24] xfsdump: (style) add stars to multiline comments Jan Tulak
2018-11-09 14:30 ` [PATCH 24/24] xfsdump: (style) remove parentheses after return Jan Tulak
2018-11-14 20:36 ` [PATCH 00/24] xfsdump: code style change Eric Sandeen
2018-11-15 12:40   ` Jan Tulak
2018-11-15 16:12     ` Eric Sandeen
2018-11-16 15:19       ` Jan Tulak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181109143004.24963-3-jtulak@redhat.com \
    --to=jtulak@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).