From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: andre.goddard@gmail.com, schwidefsky@de.ibm.com,
heiko.carstens@de.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix strim() semantics for strings that have only blanks
Date: Fri, 14 Oct 2011 10:44:17 +0200 [thread overview]
Message-ID: <1318581857.3362.8.camel@br98xy6r> (raw)
In-Reply-To: <20111013165431.b84ffab4.akpm@linux-foundation.org>
Hello Andrew,
On Thu, 2011-10-13 at 16:54 -0700, Andrew Morton wrote:
> On Wed, 12 Oct 2011 10:31:57 +0200
> > Also strim() explicitly does not have "__must_check", in order to use it
> > without using the return value.
> >
>
> This observation seems to have nothing to do with the patch?
Well, it is just a hint that it was intentionally that the return value
of strim() can be ignored and therefore I legally can use it like I do
it ;-)
> I think that strim() _should_ have __must_check annotation (which means
> that strim() simply disappears, which is good). It is only safe to
> ignore the strim() return value if the caller knows that the string
> started with a non-space. The number of situations where this is
> guaranteed are faily small, I suspect.
Everywhere I use that function I know that my string has only trailing
blanks (or only blanks). Therefore I think we should have a function
that just removes trailing blanks. Perhaps we should change strim() to:
void strim(char *str);
And change the three users that need the return value to use the
strstrip() instead:
grep -r " = strim(" linux-2.6
security/apparmor/lib.c: char *name = strim(fqname);
security/apparmor/lsm.c: args = strim(args);
security/apparmor/policy.c: hname = strim((char *)hname);
Michael
next prev parent reply other threads:[~2011-10-14 8:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-12 8:31 Michael Holzheu
2011-10-13 23:54 ` Andrew Morton
2011-10-14 8:44 ` Michael Holzheu [this message]
2011-10-17 11:24 ` André Goddard Rosa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318581857.3362.8.camel@br98xy6r \
--to=holzheu@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=andre.goddard@gmail.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®