public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-kernel@vger.kernel.org, torvalds@transmeta.com,
	trivial@rustcorp.com.au, Neil Brown <neilb@cse.unsw.edu.au>,
	dwmw2@redhat.com
Subject: Re: [PATCH] [TRIVIAL] kstrdup
Date: Mon, 20 Jan 2003 00:37:50 +0100	[thread overview]
Message-ID: <20030119233750.GA674@elf.ucw.cz> (raw)
In-Reply-To: <20030114025452.656612C385@lists.samba.org>

Hi!

> Everyone loves reimplementing strdup.  Give them a kstrdup (basically
> from drivers/md).

I believe it would be better to call it strdup.

*Or* you might want kstrdup( "foo", GFP_ATOMIC ); But if you are
hard-coding GFP_KERNEL, I believe there's no point in calling it
*k*strdup.

								Pavel
> +char *kstrdup(const char *s, int gfp)
> +{
> +	char *buf = kmalloc(strlen(s)+1, gfp);
> +	if (buf)
> +		strcpy(buf, s);
> +	return buf;
> +}



-- 
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?

  parent reply	other threads:[~2003-01-20 20:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-14  1:55 [PATCH] [TRIVIAL] kstrdup Rusty Russell
2003-01-14  3:19 ` Jeff Garzik
2003-01-15  6:45   ` Rusty Russell
2003-01-14  3:28 ` Valdis.Kletnieks
2003-01-14  3:38   ` Jeff Garzik
2003-01-14  3:53     ` Valdis.Kletnieks
2003-01-14  4:15       ` Jeff Garzik
2003-01-14  5:15         ` Valdis.Kletnieks
2003-01-14 11:48 ` Olaf Dietsche
2003-01-15  6:55   ` Rusty Russell
2003-01-19 23:37 ` Pavel Machek [this message]
2003-01-22  2:04   ` Rusty Russell
2003-01-23 14:02     ` Pavel Machek
2003-01-23 14:21       ` Martin Mares
2003-01-23 14:44         ` Pavel Machek
2003-01-29  4:51       ` Rusty Russell

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=20030119233750.GA674@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=dwmw2@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@cse.unsw.edu.au \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@transmeta.com \
    --cc=trivial@rustcorp.com.au \
    /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