mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging/dgap: Use strpbrk() instead of dgap_sindex()
@ 2015-09-11 18:22 Alexander Kuleshov
  0 siblings, 0 replies; only message in thread
From: Alexander Kuleshov @ 2015-09-11 18:22 UTC (permalink / raw)
  To: Lidza Louina
  Cc: Mark Hounschell, Daeseok Youn, Greg Kroah-Hartman,
	driverdev-devel, devel, linux-kernel, Alexander Kuleshov

The <linux/string.h> provides strpbrk() function that does
the same that the dgap_sindex(). Let's use already defined
function instead of writing custom.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 drivers/staging/dgap/dgap.c | 24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 9112dd2..ee0f022 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -287,28 +287,6 @@ static struct toklist dgap_tlist[] = {
 	{ 0,		NULL }
 };
 
-
-/*
- * dgap_sindex: much like index(), but it looks for a match of any character in
- * the group, and returns that position.
- */
-static char *dgap_sindex(char *string, char *group)
-{
-	char *ptr;
-
-	if (!string || !group)
-		return NULL;
-
-	for (; *string; string++) {
-		for (ptr = group; *ptr; ptr++) {
-			if (*ptr == *string)
-				return string;
-		}
-	}
-
-	return NULL;
-}
-
 /*
  * get a word from the input stream, also keep track of current line number.
  * words are separated by whitespace.
@@ -317,7 +295,7 @@ static char *dgap_getword(char **in)
 {
 	char *ret_ptr = *in;
 
-	char *ptr = dgap_sindex(*in, " \t\n");
+	char *ptr = strpbrk(*in, " \t\n");
 
 	/* If no word found, return null */
 	if (!ptr)
-- 
2.5.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-09-11 18:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-11 18:22 [PATCH] staging/dgap: Use strpbrk() instead of dgap_sindex() Alexander Kuleshov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®