public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Andi Kleen <ak@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Chris Wright <chrisw@sous-sol.org>
Subject: Re: [patch 2/4] add argv_split()
Date: Tue, 8 May 2007 14:59:02 -0700	[thread overview]
Message-ID: <20070508145902.fec4884d.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20070508205517.142888645@goop.org>

On Tue, 08 May 2007 13:51:31 -0700 Jeremy Fitzhardinge wrote:

> --- /dev/null
> +++ b/lib/argv_split.c
> @@ -0,0 +1,160 @@
> +
> +static const char *skip_sep(const char *cp)
> +{
> +	while(*cp && isspace(*cp))

Kernel style is space after "while", "for", "if"...

> +		cp++;
> +
> +	return cp;
> +}
> +
> +static const char *skip_arg(const char *cp)
> +{
> +	while(*cp && !isspace(*cp))
> +		cp++;
> +
> +	return cp;
> +}
> +
> +static int count_argc(const char *str)
> +{
> +	int count = 0;
> +
> +	while(*str) {
> +		str = skip_sep(str);
> +		if (*str) {
> +			count++;
> +			str = skip_arg(str);
> +		}
> +	}
> +
> +	return count;
> +}
> +
> +/**
> + * argv_free - free an argv
> + *

no blank "*" line.

> + * @argv - the argument vector to be freed

    * @argv: the argument vector to be freed


> + *
> + * Frees an argv and the strings it points to.
> + */
> +void argv_free(char **argv)
> +{
> +	char **p;
> +	for(p = argv; *p; p++)
> +		kfree(*p);
> +
> +	kfree(argv);
> +}
> +EXPORT_SYMBOL(argv_free);


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

  reply	other threads:[~2007-05-08 21:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-08 20:51 [patch 0/4] A series of cleanup patches Jeremy Fitzhardinge
2007-05-08 20:51 ` [patch 1/4] add kstrndup Jeremy Fitzhardinge
2007-05-08 21:56   ` Randy Dunlap
2007-05-08 20:51 ` [patch 2/4] add argv_split() Jeremy Fitzhardinge
2007-05-08 21:59   ` Randy Dunlap [this message]
2007-05-08 22:31   ` Jan Engelhardt
2007-05-08 22:36     ` Jeremy Fitzhardinge
2007-05-08 20:51 ` [patch 3/4] split usermodehelper setup from execution Jeremy Fitzhardinge
2007-05-08 22:01   ` Randy Dunlap
2007-05-08 22:00     ` Jeremy Fitzhardinge
2007-05-08 22:10       ` Randy Dunlap
2007-05-08 23:49   ` Rusty Russell
2007-05-09  0:00     ` Jeremy Fitzhardinge
2007-05-08 20:51 ` [patch 4/4] Add common orderly_poweroff() Jeremy Fitzhardinge
2007-05-08 21:45   ` Len Brown
2007-05-08 22:06   ` Randy Dunlap
2007-05-09 12:52   ` Andi Kleen

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=20070508145902.fec4884d.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=chrisw@sous-sol.org \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    /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