[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LNX.1.10.0808012245230.2294@titan.stealer.net>
Date: Fri, 1 Aug 2008 22:55:15 +0200 (CEST)
From: Sven Wegener <sven.wegener@...aler.net>
To: Ray Lee <ray-lk@...rabbit.org>
cc: Richard Purdie <rpurdie@...ys.net>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] leds: Avoid needless strlen() for attributes
On Fri, 1 Aug 2008, Ray Lee wrote:
> On Fri, Aug 1, 2008 at 1:30 PM, Sven Wegener <sven.wegener@...aler.net> wrote:
> > There's no need for the additional call to strlen(), we can directly return the
> > value returned by sprintf(). We now return a length value that doesn't include
> > the final '\0', but user space shouldn't bother about it anyway.
>
> Why not just add 1 to the return value of sprintf, and guarantee that
> userspace sees the same thing before and after? It's simple enough to
> do, and avoids guessing about what userspace may or may not be doing.
I thought about it, but all other places I looked at just do the return
sprintf(...); thing, so we are consistent with what the other drivers do.
And user space should be really ignoring the final '\0' currently. I know
that this can be considered some user space API change, but I think it is
in the range of what the API allows us. If noone has strong objections
against leaving the -1 out, I would keep it that way. But it's OK for me,
if someone really wants it there, but I don't think it's necessary.
Sven
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists