diff options
author | LemonBoy <thatlemon@gmail.com> | 2016-06-05 16:54:20 +0200 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2016-06-05 16:54:20 +0200 |
commit | 2e8744319d5e5e47799ec20b2f737c437e8c6398 (patch) | |
tree | 3ce3b6c107b810af3e05ea72abb82bc6ee4267df /src/core/misc.c | |
parent | cc70e8c581713309c64eb15c3999341d17988e19 (diff) | |
download | irssi-2e8744319d5e5e47799ec20b2f737c437e8c6398.zip |
str_to_uofft is a tiny wrapper over strtoul{,l}
Diffstat (limited to 'src/core/misc.c')
-rw-r--r-- | src/core/misc.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/core/misc.c b/src/core/misc.c index 74ca4725..9081abe1 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -515,15 +515,11 @@ int dec2octal(int decimal) /* string -> uoff_t */ uoff_t str_to_uofft(const char *str) { - uoff_t ret; - - ret = 0; - while (*str != '\0') { - ret = ret*10 + (*str - '0'); - str++; - } - - return ret; +#ifdef UOFF_T_LONG_LONG + return (uoff_t)strtoull(str, NULL, 10); +#else + return (uoff_t)strtoul(str, NULL, 10); +#endif } /* convert all low-ascii (<32) to ^<A..> combinations */ |