All of lore.kernel.org
 help / color / mirror / Atom feed
From: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
To: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: [PATCH 3/3] btrfs-progs: prop: remove conditions which never be satisfied
Date: Mon, 9 May 2016 16:52:11 +0900	[thread overview]
Message-ID: <573041AB.8090603@jp.fujitsu.com> (raw)
In-Reply-To: <57303A21.9070308@jp.fujitsu.com>

parse_args() always set at least one parameter, 'object', for
{get,list} subcommands. In addition, it always set all three
parameters, 'object', 'name', and 'value' for set subcommand.
So the following conditions can be removed.

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

---
 cmds-property.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/cmds-property.c b/cmds-property.c
index 46be8f3..e59882b 100644
--- a/cmds-property.c
+++ b/cmds-property.c
@@ -385,10 +385,6 @@ static int cmd_property_get(int argc, char **argv)

 	parse_args(argc, argv, cmd_property_get_usage, &types, &object, &name,
 		   NULL, 1);
-	if (!object) {
-		error("invalid arguments");
-		usage(cmd_property_get_usage);
-	}

 	if (name)
 		ret = setget_prop(types, object, name, NULL);
@@ -416,10 +412,6 @@ static int cmd_property_set(int argc, char **argv)

 	parse_args(argc, argv, cmd_property_set_usage, &types,
 		   &object, &name, &value, 3);
-	if (!object || !name || !value) {
-		error("invalid arguments");
-		usage(cmd_property_set_usage);
-	}

 	ret = setget_prop(types, object, name, value);

@@ -442,10 +434,6 @@ static int cmd_property_list(int argc, char **argv)

 	parse_args(argc, argv, cmd_property_list_usage,
 		   &types, &object, NULL, NULL, 1);
-	if (!object) {
-		error("invalid arguments");
-		usage(cmd_property_list_usage);
-	}

 	ret = dump_props(types, object, 1);

-- 
2.5.5

  parent reply	other threads:[~2016-05-09  7:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-09  7:20 [PATCH 1/3] btrfs-progs: prop: convert error messages to use error() Satoru Takeuchi
2016-05-09  7:49 ` [PATCH 2/3] btrfs-progs: prop: simplify parse_args() Satoru Takeuchi
2016-05-09  7:52 ` Satoru Takeuchi [this message]
2016-05-09 15:56 ` [PATCH 1/3] btrfs-progs: prop: convert error messages to use error() David Sterba

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=573041AB.8090603@jp.fujitsu.com \
    --to=takeuchi_satoru@jp.fujitsu.com \
    --cc=linux-btrfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.