From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753479AbbIKSXN (ORCPT ); Fri, 11 Sep 2015 14:23:13 -0400 Received: from mail-la0-f52.google.com ([209.85.215.52]:32930 "EHLO mail-la0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751377AbbIKSXM (ORCPT ); Fri, 11 Sep 2015 14:23:12 -0400 From: Alexander Kuleshov To: Lidza Louina Cc: Mark Hounschell , Daeseok Youn , Greg Kroah-Hartman , driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Alexander Kuleshov Subject: [PATCH] staging/dgap: Use strpbrk() instead of dgap_sindex() Date: Sat, 12 Sep 2015 00:22:15 +0600 Message-Id: <1441995735-32328-1-git-send-email-kuleshovmail@gmail.com> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 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 --- 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