From: Artem Bityutskiy <dedekind1@gmail.com>
To: MTD list <linux-mtd@lists.infradead.org>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Subject: [PATCH 1/2] mtd-utils: improve simple_strtoX usage commentary
Date: Fri, 8 Apr 2011 18:07:28 +0300 [thread overview]
Message-ID: <1302275249-11962-1-git-send-email-dedekind1@gmail.com> (raw)
From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
include/common.h | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/include/common.h b/include/common.h
index 2e5c2a0..0e3526a 100644
--- a/include/common.h
+++ b/include/common.h
@@ -93,6 +93,17 @@ static inline int is_power_of_2(unsigned long long n)
* simple_strtoX - convert a hex/dec/oct string into a number
* @snum: buffer to convert
* @error: set to 1 when buffer isn't fully consumed
+ *
+ * These functions are similar to the standard strtoX() functions, but they are
+ * a little bit easier to use if you want to convert full string of digits into
+ * the binary form. The typical usage:
+ *
+ * int error = 0;
+ * unsigned long num;
+ *
+ * num = simple_strtoul(str, &error);
+ * if (error || !is_valid_number(num))
+ * error_happened();
*/
#define simple_strtoX(func, type) \
static inline type simple_##func(const char *snum, int *error) \
--
1.7.2.3
next reply other threads:[~2011-04-08 15:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-08 15:07 Artem Bityutskiy [this message]
2011-04-08 15:07 ` [PATCH 2/2] mtd-utils: switch ubi and ubifs tools to use common strtoX funcs Artem Bityutskiy
2011-04-08 16:20 ` [PATCH 1/2] mtd-utils: improve simple_strtoX usage commentary Mike Frysinger
2011-04-09 14:39 ` Artem Bityutskiy
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=1302275249-11962-1-git-send-email-dedekind1@gmail.com \
--to=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=vapier.adi@gmail.com \
/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