Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/include/xatonum.h
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/include/xatonum.h
r1765 r2725 5 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 6 6 * 7 * Licensed under GPLv2, see file LICENSE in this tarball for details.7 * Licensed under GPLv2, see file LICENSE in this source tree. 8 8 */ 9 10 PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 9 11 10 12 /* Provides extern declarations of functions */ 11 13 #define DECLARE_STR_CONV(type, T, UT) \ 12 14 \ 13 unsigned type xstrto##UT##_range_sfx(const char *str, int b, unsigned type l, unsigned type u, const struct suffix_mult *sfx); \ 14 unsigned type xstrto##UT##_range(const char *str, int b, unsigned type l, unsigned type u); \ 15 unsigned type xstrto##UT##_sfx(const char *str, int b, const struct suffix_mult *sfx); \ 16 unsigned type xstrto##UT(const char *str, int b); \ 17 unsigned type xato##UT##_range_sfx(const char *str, unsigned type l, unsigned type u, const struct suffix_mult *sfx); \ 18 unsigned type xato##UT##_range(const char *str, unsigned type l, unsigned type u); \ 19 unsigned type xato##UT##_sfx(const char *str, const struct suffix_mult *sfx); \ 20 unsigned type xato##UT(const char *str); \ 21 type xstrto##T##_range_sfx(const char *str, int b, type l, type u, const struct suffix_mult *sfx); \ 22 type xstrto##T##_range(const char *str, int b, type l, type u); \ 23 type xato##T##_range_sfx(const char *str, type l, type u, const struct suffix_mult *sfx); \ 24 type xato##T##_range(const char *str, type l, type u); \ 25 type xato##T##_sfx(const char *str, const struct suffix_mult *sfx); \ 26 type xato##T(const char *str); \ 15 unsigned type xstrto##UT##_range_sfx(const char *str, int b, unsigned type l, unsigned type u, const struct suffix_mult *sfx) FAST_FUNC; \ 16 unsigned type xstrto##UT##_range(const char *str, int b, unsigned type l, unsigned type u) FAST_FUNC; \ 17 unsigned type xstrto##UT##_sfx(const char *str, int b, const struct suffix_mult *sfx) FAST_FUNC; \ 18 unsigned type xstrto##UT(const char *str, int b) FAST_FUNC; \ 19 unsigned type xato##UT##_range_sfx(const char *str, unsigned type l, unsigned type u, const struct suffix_mult *sfx) FAST_FUNC; \ 20 unsigned type xato##UT##_range(const char *str, unsigned type l, unsigned type u) FAST_FUNC; \ 21 unsigned type xato##UT##_sfx(const char *str, const struct suffix_mult *sfx) FAST_FUNC; \ 22 unsigned type xato##UT(const char *str) FAST_FUNC; \ 23 type xstrto##T##_range_sfx(const char *str, int b, type l, type u, const struct suffix_mult *sfx) FAST_FUNC; \ 24 type xstrto##T##_range(const char *str, int b, type l, type u) FAST_FUNC; \ 25 type xstrto##T(const char *str, int b) FAST_FUNC; \ 26 type xato##T##_range_sfx(const char *str, type l, type u, const struct suffix_mult *sfx) FAST_FUNC; \ 27 type xato##T##_range(const char *str, type l, type u) FAST_FUNC; \ 28 type xato##T##_sfx(const char *str, const struct suffix_mult *sfx) FAST_FUNC; \ 29 type xato##T(const char *str) FAST_FUNC; \ 27 30 28 31 /* Unsigned long long functions always exist */ … … 65 68 { return xstrto##W##_range(str, b, l, u); } \ 66 69 static ALWAYS_INLINE \ 70 narrow xstrto##N(const char *str, int b) \ 71 { return xstrto##W(str, b); } \ 72 static ALWAYS_INLINE \ 67 73 narrow xato##N##_range_sfx(const char *str, narrow l, narrow u, const struct suffix_mult *sfx) \ 68 74 { return xato##W##_range_sfx(str, l, u, sfx); } \ … … 96 102 /* Specialized */ 97 103 98 int BUG_xatou32_unimplemented(void);104 uint32_t BUG_xatou32_unimplemented(void); 99 105 static ALWAYS_INLINE uint32_t xatou32(const char *numstr) 100 106 { … … 106 112 } 107 113 108 /* Non-aborting kind of convertors */114 /* Non-aborting kind of convertors: bb_strto[u][l]l */ 109 115 110 unsigned long long bb_strtoull(const char *arg, char **endp, int base); 111 long long bb_strtoll(const char *arg, char **endp, int base); 116 /* On exit: errno = 0 only if there was non-empty, '\0' terminated value 117 * errno = EINVAL if value was not '\0' terminated, but otherwise ok 118 * Return value is still valid, caller should just check whether end[0] 119 * is a valid terminating char for particular case. OTOH, if caller 120 * requires '\0' terminated input, [s]he can just check errno == 0. 121 * errno = ERANGE if value had alphanumeric terminating char ("1234abcg"). 122 * errno = ERANGE if value is out of range, missing, etc. 123 * errno = ERANGE if value had minus sign for strtouXX (even "-0" is not ok ) 124 * return value is all-ones in this case. 125 */ 126 127 unsigned long long bb_strtoull(const char *arg, char **endp, int base) FAST_FUNC; 128 long long bb_strtoll(const char *arg, char **endp, int base) FAST_FUNC; 112 129 113 130 #if ULONG_MAX == ULLONG_MAX … … 119 136 { return bb_strtoll(arg, endp, base); } 120 137 #else 121 unsigned long bb_strtoul(const char *arg, char **endp, int base) ;122 long bb_strtol(const char *arg, char **endp, int base) ;138 unsigned long bb_strtoul(const char *arg, char **endp, int base) FAST_FUNC; 139 long bb_strtol(const char *arg, char **endp, int base) FAST_FUNC; 123 140 #endif 124 141 … … 138 155 { return bb_strtol(arg, endp, base); } 139 156 #else 140 unsigned bb_strtou(const char *arg, char **endp, int base) ;141 int bb_strtoi(const char *arg, char **endp, int base) ;157 unsigned bb_strtou(const char *arg, char **endp, int base) FAST_FUNC; 158 int bb_strtoi(const char *arg, char **endp, int base) FAST_FUNC; 142 159 #endif 143 160 144 int BUG_bb_strtou32_unimplemented(void);161 uint32_t BUG_bb_strtou32_unimplemented(void); 145 162 static ALWAYS_INLINE 146 163 uint32_t bb_strtou32(const char *arg, char **endp, int base) … … 155 172 /* Floating point */ 156 173 157 /* double bb_strtod(const char *arg, char **endp); */ 174 double bb_strtod(const char *arg, char **endp) FAST_FUNC; 175 176 POP_SAVED_FUNCTION_VISIBILITY
Note:
See TracChangeset
for help on using the changeset viewer.