mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Julia Lawall <julia@diku.dk>
Cc: walter harms <wharms@bfs.de>,
	devel@driverdev.osuosl.org, gregkh@suse.de,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] drivers/staging/cx25821: Use kstrdup
Date: Mon, 18 Oct 2010 10:55:42 -0700	[thread overview]
Message-ID: <1287424542.20968.121.camel@Joe-Laptop> (raw)
In-Reply-To: <Pine.LNX.4.64.1010181942570.15744@ask.diku.dk>

On Mon, 2010-10-18 at 19:44 +0200, Julia Lawall wrote:
> On Mon, 18 Oct 2010, Joe Perches wrote:
> 
> > Perhaps it's more readable code to recheck the
> > field name flag and introduce a temporary
> > char *fname so the slightly unusual reuse of
> > 	field = kstrdup(field, GFP)
> > becomes
> > 	field = kstrdup(fname, GFP)
> 
> Before I had a local variable filename.  I preferred that because I felt 
> uneasy about putting both statically and dynamically allocated memory in 
> the same field.  But it does mean adding a new local variable.

I think readability is better using a temporary.

> I'm not sure to understand "recheck the field name flag", though.

Sorry, poor wording.  I meant using this style:

	if (field && *field)
		foo
	else if (field)
		bar
	else
		baz

instead of:

	if (field) {
		if (*field)
			foo
		else
			bar
	} else
		baz



  reply	other threads:[~2010-10-18 17:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-17 18:48 [PATCH 0/3] Use kasprintf Julia Lawall
2010-10-17 18:48 ` [PATCH 1/3] drivers/staging/cx25821: " Julia Lawall
2010-10-18  7:15   ` walter harms
2010-10-18  8:22     ` Julia Lawall
2010-10-18  9:27       ` walter harms
2010-10-18 12:25         ` [PATCH 1/3] drivers/staging/cx25821: Use kstrdup Julia Lawall
2010-10-18 17:38           ` Joe Perches
2010-10-18 17:44             ` Julia Lawall
2010-10-18 17:55               ` Joe Perches [this message]
2010-10-18 17:58                 ` Julia Lawall
2010-10-18 20:43             ` Julia Lawall
2010-10-17 18:48 ` [PATCH 2/3] fs/ceph/xattr.c: Use kasprintf Julia Lawall
2010-10-17 18:54   ` Joe Perches
2010-10-17 19:02     ` Julia Lawall
2010-10-17 19:55     ` [PATCH 2/3] fs/ceph/xattr.c: Use kmemdup Julia Lawall
2010-10-17 21:36       ` Sage Weil
2010-10-17 18:48 ` [PATCH 3/3] fs/jffs2/dir.c: Use kasprintf Julia Lawall
     [not found]   ` <1287341849.20968.62.camel@Joe-Laptop>
2010-10-17 19:56     ` [PATCH 3/3] fs/jffs2/dir.c: Use kmemdup Julia Lawall
2010-10-18  3:43       ` Artem Bityutskiy
2010-10-18 18:09 ` [PATCH 0/3] Use kasprintf Paulo Marques
2010-10-18 20:02   ` Julia Lawall

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=1287424542.20968.121.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wharms@bfs.de \
    /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®