diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-04-08 18:05:10 +0300 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-04-09 17:49:22 +0300 |
commit | dd2a035dd6cb7408a99fac2052b6812e7f489de8 (patch) | |
tree | c4778f9e85fc100fc01bf58948e28964fce3de6c | |
parent | c67ebe5dabe68fe3772d575c2a9fce3abea7b93a (diff) |
mtd-utils: improve simple_strtoX usage commentary
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r-- | include/common.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h index 2e5c2a0..c37660c 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 || ... if needed, your check that num is not out of range ...) + * error_happened(); */ #define simple_strtoX(func, type) \ static inline type simple_##func(const char *snum, int *error) \ |