From 8f2737476805ee9629af1ad16646e6258825a24b Mon Sep 17 00:00:00 2001 From: Harshit Sharma Date: Fri, 22 May 2020 13:07:17 +0530 Subject: [PATCH] payloads/libpayload/libc: Do cosmetic fixes Make the code follow the coding style. Signed-off-by: Harshit Sharma Change-Id: I4ca168c4aedddef51103b270f105feab93739ecc Reviewed-on: https://review.coreboot.org/c/coreboot/+/41649 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- payloads/libpayload/libc/string.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/payloads/libpayload/libc/string.c b/payloads/libpayload/libc/string.c index b1d89d3fcc..c05a012f51 100644 --- a/payloads/libpayload/libc/string.c +++ b/payloads/libpayload/libc/string.c @@ -361,7 +361,7 @@ char *strsep(char **stringp, const char *delim) token = walk = *stringp; /* Walk, search for delimiters */ - while(*walk && !strchr(delim, *walk)) + while (*walk && !strchr(delim, *walk)) walk++; if (*walk) { @@ -424,7 +424,7 @@ long long int strtoll(const char *orig_ptr, char **endptr, int base) /* Purge whitespace */ - for( ; *ptr && isspace(*ptr); ptr++); + for ( ; *ptr && isspace(*ptr); ptr++); if (ptr[0] == '-') { is_negative = 1; @@ -478,7 +478,7 @@ unsigned long long int strtoull(const char *ptr, char **endptr, int base) /* Purge whitespace */ - for( ; *ptr && isspace(*ptr); ptr++); + for ( ; *ptr && isspace(*ptr); ptr++); if (!*ptr) return 0; @@ -491,9 +491,9 @@ unsigned long long int strtoull(const char *ptr, char **endptr, int base) else if (ptr[0] == '0') { base = 8; ptr++; - } - else + } else { base = 10; + } } /* Base 16 allows the 0x on front - so skip over it */ @@ -504,7 +504,7 @@ unsigned long long int strtoull(const char *ptr, char **endptr, int base) ptr += 2; } - for( ; *ptr && _valid(*ptr, base); ptr++) + for ( ; *ptr && _valid(*ptr, base); ptr++) ret = (ret * base) + _offset(*ptr, base); if (endptr != NULL) @@ -516,7 +516,8 @@ unsigned long long int strtoull(const char *ptr, char **endptr, int base) unsigned long int strtoul(const char *ptr, char **endptr, int base) { unsigned long long val = strtoull(ptr, endptr, base); - if (val > ULONG_MAX) return ULONG_MAX; + if (val > ULONG_MAX) + return ULONG_MAX; return val; } @@ -577,7 +578,7 @@ 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) +char *strtok_r(char *str, const char *delim, char **ptr) { /* start new tokenizing job or continue existing one? */ if (str == NULL) @@ -607,7 +608,7 @@ 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) +char *strtok(char *str, const char *delim) { return strtok_r(str, delim, strtok_global); }