From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz
Subject: [PATCH RESEND V2 1/3] btrfs-progs: Create is_numerical() helper function
Date: Sat, 10 Oct 2015 22:30:56 +0800 [thread overview]
Message-ID: <1444487458-2988-2-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1444487458-2988-1-git-send-email-anand.jain@oracle.com>
This is done by moving existing is_numerical() to utils-lib.c
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
V2: Subject updated from
btrfs-progs: move is_numerical to utils-lib.h and make it non static
cmds-replace.c | 11 -----------
utils-lib.c | 11 +++++++++++
utils.h | 1 +
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/cmds-replace.c b/cmds-replace.c
index 9ab8438..86162b6 100644
--- a/cmds-replace.c
+++ b/cmds-replace.c
@@ -65,17 +65,6 @@ static const char * const replace_cmd_group_usage[] = {
NULL
};
-static int is_numerical(const char *str)
-{
- if (!(*str >= '0' && *str <= '9'))
- return 0;
- while (*str >= '0' && *str <= '9')
- str++;
- if (*str != '\0')
- return 0;
- return 1;
-}
-
static int dev_replace_cancel_fd = -1;
static void dev_replace_sigint_handler(int signal)
{
diff --git a/utils-lib.c b/utils-lib.c
index 79ef35e..9ac0b7b 100644
--- a/utils-lib.c
+++ b/utils-lib.c
@@ -38,3 +38,14 @@ u64 arg_strtou64(const char *str)
}
return value;
}
+
+int is_numerical(const char *str)
+{
+ if (!(*str >= '0' && *str <= '9'))
+ return 0;
+ while (*str >= '0' && *str <= '9')
+ str++;
+ if (*str != '\0')
+ return 0;
+ return 1;
+}
diff --git a/utils.h b/utils.h
index 192f3d1..0a2130d 100644
--- a/utils.h
+++ b/utils.h
@@ -269,5 +269,6 @@ const char *get_argv0_buf(void);
"-t|--tbytes show sizes in TiB, or TB with --si"
unsigned int get_unit_mode_from_arg(int *argc, char *argv[], int df_mode);
+int is_numerical(const char *str);
#endif
--
2.4.1
next prev parent reply other threads:[~2015-10-10 14:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-10 14:30 [PATCH RESEND 0/3] btrfs-progs: Introduce device delete by devid Anand Jain
2015-10-10 14:30 ` Anand Jain [this message]
2015-10-10 14:30 ` [PATCH 2/3] btrfs-progs: Code optimize and cleanup device add Anand Jain
2015-10-10 14:30 ` [PATCH V4 3/3] btrfs-progs: Introduce device delete by devid Anand Jain
2015-10-13 12:48 ` [PATCH RESEND 0/3] " David Sterba
2015-10-14 10:56 ` Anand Jain
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=1444487458-2988-2-git-send-email-anand.jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.cz \
--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 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).