public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Olaf Dietsche <olaf.dietsche#list.linux-kernel@t-online.de>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PARAM 1/4: strcspn
Date: Sat, 16 Nov 2002 01:25:55 +0100	[thread overview]
Message-ID: <87k7jeicmk.fsf@goat.bogus.local> (raw)
In-Reply-To: <20021115222725.1A56F2C0FA@lists.samba.org> (Rusty Russell's message of "Sat, 16 Nov 2002 09:14:04 +1100")

Rusty Russell <rusty@rustcorp.com.au> writes:

> +size_t strcspn(const char *s, const char *reject)
> +{
> +	const char *p;
> +	const char *r;
> +	size_t count = 0;
> +
> +	for (p = s; *p != '\0'; ++p) {
> +		for (r = reject; *r != '\0'; ++r) {
> +			if (*p == *r)
> +				return count;
> +		}
> +		++count;
> +	}
> +
> +	return count;
> +}	

How about "return p - s;" instead of "count"?

Regards, Olaf.

      parent reply	other threads:[~2002-11-16  0:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-15 22:14 [PATCH] PARAM 1/4: strcspn Rusty Russell
2002-11-15 22:45 ` Jeff Garzik
2002-11-16  0:25 ` Olaf Dietsche [this message]

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=87k7jeicmk.fsf@goat.bogus.local \
    --to=olaf.dietsche#list.linux-kernel@t-online.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@transmeta.com \
    /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