From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757588Ab0JRR60 (ORCPT ); Mon, 18 Oct 2010 13:58:26 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:45623 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754540Ab0JRR6Z (ORCPT ); Mon, 18 Oct 2010 13:58:25 -0400 Date: Mon, 18 Oct 2010 19:58:23 +0200 (CEST) From: Julia Lawall To: Joe Perches Cc: walter harms , 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 In-Reply-To: <1287424542.20968.121.camel@Joe-Laptop> Message-ID: References: <1287341311-11161-1-git-send-email-julia@diku.dk> <1287341311-11161-2-git-send-email-julia@diku.dk> <4CBBF407.7060705@bfs.de> <4CBC12EC.60109@bfs.de> <1287423539.20968.115.camel@Joe-Laptop> <1287424542.20968.121.camel@Joe-Laptop> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 18 Oct 2010, Joe Perches wrote: > 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 OK :) I'll do that. julia