[PATCH v2 3/7] vsprintf: give it some care to please checkpatch.pl

[PATCH v2 3/7] vsprintf: give it some care to please checkpatch.pl

Post by AndrGoddar » Wed, 04 Nov 2009 02:30:03


rom 769e380101cfa3a1510cf2b2e88e0420dfc9ddce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= < XXXX@XXXXX.COM >
Date: Sun, 1 Nov 2009 13:20:29 -0200
Subject: [PATCH v2 3/7] vsprintf: give it some care to please checkpatch.pl
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Most relevant complaints were addressed.

Signed-off-by: AndrGoddard Rosa<< XXXX@XXXXX.COM >>
---
lib/vsprintf.c | 186 ++++++++++++++++++++++++++++++--------------------------
1 files changed, 99 insertions(+), 87 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 403e835..00153c5 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -9,7 +9,7 @@
* Wirzenius wrote this portably, Torvalds fucked it up :-)
*/

-/*
+/*
* Fri Jul 13 2001 Crutcher Dunnavant<
* - changed to provide snprintf and vsnprintf functions
* So Feb 1 16:51:32 CET 2004 Juergen Quade<< XXXX@XXXXX.COM >>
@@ -73,9 +73,9 @@ unsigned long simple_strtoul(const char *cp, char
**endp, unsigned int base)
result = result * base + value;
cp++;
}
-
if (endp)
*endp = (char *)cp;
+
return result;
}
EXPORT_SYMBOL(simple_strtoul);
@@ -88,8 +88,9 @@ EXPORT_SYMBOL(simple_strtoul);
*/
long simple_strtol(const char *cp, char **endp, unsigned int base)
{
- if(*cp == '-')
+ if (*cp == '-')
return -simple_strtoul(cp + 1, endp, base);
+
return simple_strtoul(cp, endp, base);
}
EXPORT_SYMBOL(simple_strtol);
@@ -119,9 +120,9 @@ unsigned long long simple_strtoull(const char *cp,
char **endp, unsigned int bas
result = result * base + value;
cp++;
}
-
if (endp)
*endp = (char *)cp;
+
return result;
}
EXPORT_SYMBOL(simple_strtoull);
@@ -134,8 +135,9 @@ EXPORT_SYMBOL(simple_strtoull);
*/
long long simple_strtoll(const char *cp, char **endp, unsigned int base)
{
- if(*cp=='-')
+ if (*cp == '-')
return -simple_strtoull(cp + 1, endp, base);
+
return simple_strtoull(cp, endp, base);
}

@@ -175,6 +177,7 @@ int strict_strtoul(const char *cp, unsigned int
base, unsigned long *res)
val = simple_strtoul(cp, &tail, base);
if (tail == cp)
return -EINVAL;
+
if ((*tail == '\0') ||
((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {
*res = val;
@@ -287,10 +290,11 @@ EXPORT_SYMBOL(strict_strtoll);

static int skip_atoi(const char **s)
{
- int i=0;
+ int i = 0;

while (isdigit(**s))
i = i*10 + *((*s)++) - '0';
+
return i;
}

@@ -304,7 +308,7 @@ static int skip_atoi(const char **s)
/* Formats correctly any integer in [0,99999].
* Outputs from one to five digits depending on input.
* On i386 gcc 4.1.2 -O2: ~250 bytes of code. */
-static char* put_dec_trunc(char *buf, unsigned q)
+static char *put_dec_trunc(char *buf, unsigned q)
{
unsigned d3, d2, d1, d0;
d1 = (>>>4) & 0xf;
@@ -333,14 +337,15 @@ static char* put_dec_trunc(char *buf, unsigned q)
d3 = d3 - 10*q;
*buf++ = d3 + '0'; /* next digit */
if (q != 0)
- *buf++ = q + '0'; /* most sign. digit */
+ *buf++ = q + '0'; /* most sign. digit */
}
}
}
+
return buf;
}
/* Same with if's removed. Always emits five digits */
-static char* put_dec_full(char *buf, unsigned q)
+static char *put_dec_full(char *buf, unsigned q)
{
/* BTW, if q is in [0,9999], 8-bit ints will be enough, */
/* but anyway, gcc prod