mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
lib/kstrtox: common code between kstrto*() and simple_strto*() functions
Currently termination logic (\0 or \n\0) is hardcoded in _kstrtoull(), avoid that for code reuse between kstrto*() and simple_strtoull(). Essentially, make them different only in termination logic. simple_strtoull() (and scanf(), BTW) ignores integer overflow, that's a bug we currently don't have guts to fix, making KSTRTOX_OVERFLOW hack necessary. Almost forgot: patch shrinks code size by about ~80 bytes on x86_64. Signed-off-by: Alexey Dobriyan <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
b3c49c05b7
commit
1dff46d698
3 changed files with 68 additions and 48 deletions
8
lib/kstrtox.h
Normal file
8
lib/kstrtox.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef _LIB_KSTRTOX_H
|
||||
#define _LIB_KSTRTOX_H
|
||||
|
||||
#define KSTRTOX_OVERFLOW (1U << 31)
|
||||
const char *_parse_integer_fixup_radix(const char *s, unsigned int *base);
|
||||
unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *res);
|
||||
|
||||
#endif
|
||||
Loading…
Reference in a new issue