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?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo _at_ vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Follow-Ups:
- Re: [PATCH] [TRIVIAL] kstrdupRusty Russell
- [PATCH] [TRIVIAL] kstrdupRusty Russell
- Prev by Date: Re: any chance of 2.6.0-test*?
- Next by Date: Re: ANN: LKMB (Linux Kernel Module Builder) version 0.1.16
- Previous by thread: Re: [PATCH] [TRIVIAL] kstrdup
- Next by thread: Re: [PATCH] [TRIVIAL] kstrdup
- Indexes:[Main][Thread]