strsep() instead of strtok()

Ingo Oeser (ingo.oeser@informatik.tu-chemnitz.de)
Fri, 25 Jun 1999 20:57:42 +0200 (CEST)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

--1837524312-1262815616-930337062=:18342
Content-Type: TEXT/PLAIN; charset=US-ASCII

Hi there,

I've implemented strsep() for use in kernel.

Reasons:
- strsep() is reentrant instead of strtok() which need an
global variable (___strtok)

- strsep() is a bit faster, because you need not copy the
variable "send" -> "___strtok" every time you use it, and
you need no global protection for the "___strtok" variable

If this patch is accepted (within two weeks) I'm going to change
every occourance of "strtok()" to "strsep()" with every needed
implication.

There seem to be no point for using strtok() any longer for me.

Regards

Ingo Oeser

-- 
Feel the power of the penguin - run linux@your.pc
<esc>:x

--1837524312-1262815616-930337062=:18342 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=diff Content-Transfer-Encoding: BASE64 Content-ID: <Pine.LNX.4.10.9906252057420.18342@nightmaster.csn.tu-chemnitz.de> Content-Description: Content-Disposition: attachment; filename=diff

LS0tIC91c3Ivc3JjL2xpbnV4LTIuMi45L2xpYi9zdHJpbmcuYwlTdW4gU2Vw ICA2IDIwOjE5OjE1IDE5OTgNCisrKyAvdXNyL3NyYy9saW51eC9saWIvc3Ry aW5nLmMJRnJpIEp1biAyNSAxNTowMTo0MyAxOTk5DQpAQCAtOSw2ICs5LDEw IEBADQogICogYXMgaW5saW5lIGNvZGUgaW4gPGFzbS14eC9zdHJpbmcuaD4N CiAgKg0KICAqIFRoZXNlIGFyZSBidWdneSBhcyB3ZWxsLi4NCisgKg0KKyAq ICogRnJpIEp1biAyNSAxOTk5LCBJbmdvIE9lc2VyIDxpb2VAaW5mb3JtYXRp ay50dS1jaGVtbml0ei5kZT4NCisgKiAtICBBZGRlZCBzdHJzZXAoKSB3aGlj aCB3aWxsIHJlcGxhY2Ugc3RydG9rKCkgc29vbiAoYmVjYXVzZSBzdHJzZXAo KSBp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osY29uc3QgY2hhciAqKTsNCiBleHRlcm4gY2hhciAqIHN0cnRvayhj aGFyICosY29uc3QgY2hhciAqKTsNCitleHRlcm4gY2hhciAqIHN0cnNlcChj aGFyICoqLGNvbnN0IGNoYXIgKik7DQogZXh0ZXJuIGNoYXIgKiBzdHJzdHIo Y29uc3QgY2hhciAqLGNvbnN0IGNoYXIgKik7DQogZXh0ZXJuIF9fa2VybmVs X3NpemVfdCBzdHJsZW4oY29uc3QgY2hhciAqKTsNCiBleHRlcm4gX19rZXJu ZWxfc2l6ZV90IHN0cm5sZW4oY29uc3QgY2hhciAqLF9fa2VybmVsX3NpemVf dCk7DQo= --1837524312-1262815616-930337062=:18342--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/