diff options
author | Stefan Tauner <stefan.tauner@gmx.at> | 2013-06-25 19:25:46 +0200 |
---|---|---|
committer | Anton Kochkov <anton.kochkov@gmail.com> | 2013-06-27 14:46:43 +0200 |
commit | 3509ad366dceb346025d6882a59a7b6a4a357ee9 (patch) | |
tree | 72bf191fc4b42cc3b5600c389d6e9acc0ae5da05 /payloads/libpayload/libc | |
parent | 714212a42115b205b132a901bf86b8876d6aa3f0 (diff) | |
download | coreboot-3509ad366dceb346025d6882a59a7b6a4a357ee9.tar.xz |
libpayload: Fix whitespace errors
Change-Id: Ibc36988745cbc7ede2a00da376b5dd295014ffb1
Signed-off-by: Stefan Tauner <stefan.tauner@gmx.at>
Reviewed-on: http://review.coreboot.org/3535
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Nico Huber <nico.huber@secunet.com>
Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com>
Diffstat (limited to 'payloads/libpayload/libc')
-rw-r--r-- | payloads/libpayload/libc/qsort.c | 2 | ||||
-rw-r--r-- | payloads/libpayload/libc/string.c | 90 |
2 files changed, 44 insertions, 48 deletions
diff --git a/payloads/libpayload/libc/qsort.c b/payloads/libpayload/libc/qsort.c index c684333b03..aad2aa38f0 100644 --- a/payloads/libpayload/libc/qsort.c +++ b/payloads/libpayload/libc/qsort.c @@ -47,7 +47,7 @@ static __inline void swapfunc(char *, char *, size_t, int); TYPE t = *pi; \ *pi++ = *pj; \ *pj++ = t; \ - } while (--i > 0); \ + } while (--i > 0); \ } #define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ diff --git a/payloads/libpayload/libc/string.c b/payloads/libpayload/libc/string.c index cfa0b4ada4..6151164d68 100644 --- a/payloads/libpayload/libc/string.c +++ b/payloads/libpayload/libc/string.c @@ -383,32 +383,32 @@ char *strsep(char **stringp, const char *delim) static int _valid(char ch, int base) { - char end = (base > 9) ? '9' : '0' + (base - 1); + char end = (base > 9) ? '9' : '0' + (base - 1); - /* all bases will be some subset of the 0-9 range */ + /* all bases will be some subset of the 0-9 range */ - if (ch >= '0' && ch <= end) - return 1; + if (ch >= '0' && ch <= end) + return 1; - /* Bases > 11 will also have to match in the a-z range */ + /* Bases > 11 will also have to match in the a-z range */ - if (base > 11) { - if (tolower(ch) >= 'a' && - tolower(ch) <= 'a' + (base - 11)) - return 1; - } + if (base > 11) { + if (tolower(ch) >= 'a' && + tolower(ch) <= 'a' + (base - 11)) + return 1; + } - return 0; + return 0; } /* Return the "value" of the character in the given base */ static int _offset(char ch, int base) { - if (ch >= '0' && ch <= '9') - return ch - '0'; - else - return 10 + tolower(ch) - 'a'; + if (ch >= '0' && ch <= '9') + return ch - '0'; + else + return 10 + tolower(ch) - 'a'; } /** @@ -421,27 +421,27 @@ static int _offset(char ch, int base) long int strtol(const char *ptr, char **endptr, int base) { - int ret = 0; + int ret = 0; int negative = 1; if (endptr != NULL) *endptr = (char *) ptr; - /* Purge whitespace */ + /* Purge whitespace */ - for( ; *ptr && isspace(*ptr); ptr++); + for( ; *ptr && isspace(*ptr); ptr++); if (ptr[0] == '-') { negative = -1; ptr++; } - if (!*ptr) - return 0; + if (!*ptr) + return 0; - /* Determine the base */ + /* Determine the base */ - if (base == 0) { + if (base == 0) { if (ptr[0] == '0' && (ptr[1] == 'x' || ptr[1] == 'X')) base = 16; else if (ptr[0] == '0') { @@ -450,7 +450,7 @@ long int strtol(const char *ptr, char **endptr, int base) } else base = 10; - } + } /* Base 16 allows the 0x on front - so skip over it */ @@ -460,18 +460,18 @@ long int strtol(const char *ptr, char **endptr, int base) } /* If the first character isn't valid, then don't - * bother */ + * bother */ - if (!*ptr || !_valid(*ptr, base)) - return 0; + if (!*ptr || !_valid(*ptr, base)) + return 0; - for( ; *ptr && _valid(*ptr, base); ptr++) - ret = (ret * base) + _offset(*ptr, base); + for( ; *ptr && _valid(*ptr, base); ptr++) + ret = (ret * base) + _offset(*ptr, base); if (endptr != NULL) *endptr = (char *) ptr; - return ret * negative; + return ret * negative; } long atol(const char *nptr) @@ -489,21 +489,21 @@ long atol(const char *nptr) unsigned long long int strtoull(const char *ptr, char **endptr, int base) { - unsigned long long int ret = 0; + unsigned long long int ret = 0; if (endptr != NULL) *endptr = (char *) ptr; - /* Purge whitespace */ + /* Purge whitespace */ - for( ; *ptr && isspace(*ptr); ptr++); + for( ; *ptr && isspace(*ptr); ptr++); - if (!*ptr) - return 0; + if (!*ptr) + return 0; - /* Determine the base */ + /* Determine the base */ - if (base == 0) { + if (base == 0) { if (ptr[0] == '0' && (ptr[1] == 'x' || ptr[1] == 'X')) base = 16; else if (ptr[0] == '0') { @@ -512,7 +512,7 @@ unsigned long long int strtoull(const char *ptr, char **endptr, int base) } else base = 10; - } + } /* Base 16 allows the 0x on front - so skip over it */ @@ -522,18 +522,18 @@ unsigned long long int strtoull(const char *ptr, char **endptr, int base) } /* If the first character isn't valid, then don't - * bother */ + * bother */ - if (!*ptr || !_valid(*ptr, base)) - return 0; + if (!*ptr || !_valid(*ptr, base)) + return 0; - for( ; *ptr && _valid(*ptr, base); ptr++) - ret = (ret * base) + _offset(*ptr, base); + for( ; *ptr && _valid(*ptr, base); ptr++) + ret = (ret * base) + _offset(*ptr, base); if (endptr != NULL) *endptr = (char *) ptr; - return ret; + return ret; } unsigned long int strtoul(const char *ptr, char **endptr, int base) @@ -550,7 +550,6 @@ unsigned long int strtoul(const char *ptr, char **endptr, int base) * @param a A pointer to an array of characters that match the prefix * @return The number of matching characters */ - size_t strspn(const char *s, const char *a) { int i, j; @@ -575,7 +574,6 @@ size_t strspn(const char *s, const char *a) * @param a A pointer to an array of characters that do not match the prefix * @return The number of not matching characters */ - size_t strcspn(const char *s, const char *a) { int i, j; @@ -602,7 +600,6 @@ size_t strcspn(const char *s, const char *a) * @param ptr A pointer to a string pointer to keep state of the tokenizer * @return Pointer to token */ - char* strtok_r(char *str, const char *delim, char **ptr) { /* start new tokenizing job or continue existing one? */ @@ -629,7 +626,6 @@ static char **strtok_global; * @param delim A pointer to an array of characters that delimit the token * @return Pointer to token */ - char* strtok(char *str, const char *delim) { return strtok_r(str, delim, strtok_global); |