lkml.org 
[lkml]   [2006]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: resource_size_t and printk()
On Wed, Jul 12, 2006 at 08:15:35AM -0700, Randy.Dunlap wrote:
> I know it's more wordy, but we usually use
> (unsigned long long), not just (long long).
>
> Wish we had an abbreviation for that.

We have a specific qualifier for ptrdiff_t... Why not add one (untested!)
for resource_size_t, and get rid of all these bloody annoying casts?

I'm more than slightly irritated to have to go and add ugly
(unsigned long long) casts to squelch compiler whining on parisc.

This patch will probably cause even more compiler warnings thought because
gcc will try to be too smart with the use of formats...

Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index bed7229..2d71ff6 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -343,7 +343,8 @@ int vsnprintf(char *buf, size_t size, co
/* get the conversion qualifier */
qualifier = -1;
if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' ||
- *fmt =='Z' || *fmt == 'z' || *fmt == 't') {
+ *fmt == 'Z' || *fmt == 'z' || *fmt == 't' ||
+ *fmt == 'r') {
qualifier = *fmt;
++fmt;
if (qualifier == 'l' && *fmt == 'l') {
@@ -477,6 +478,8 @@ int vsnprintf(char *buf, size_t size, co
num = (unsigned short) va_arg(args, int);
if (flags & SIGN)
num = (signed short) num;
+ } else if (qualifier == 'r') {
+ num = va_arg(args, resource_size_t);
} else {
num = va_arg(args, unsigned int);
if (flags & SIGN)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-07-12 17:37    [from the cache]
©2003-2011 Jasper Spaans