Skip to content

Commit

Permalink
staging/dgap: Use strpbrk() instead of dgap_sindex()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
0xAX authored and gregkh committed Sep 13, 2015
1 parent 7e25075 commit b9f7f1d
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions drivers/staging/dgap/dgap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down

0 comments on commit b9f7f1d

Please sign in to comment.