Util-Linux package development
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@gnu.org>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: [PATCH] whereis: remove find()
Date: Sun, 24 Jul 2011 19:05:48 -0400	[thread overview]
Message-ID: <1311548748.3367.14.camel@offbook> (raw)

From: Davidlohr Bueso <dave@gnu.org>
Date: Sun, 24 Jul 2011 10:59:25 -0400

Because findv() can do the same job find() does, we can simply remove it and call findv() with the size of each array.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 misc-utils/whereis.c |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/misc-utils/whereis.c b/misc-utils/whereis.c
index 4f841f9..a331f45 100644
--- a/misc-utils/whereis.c
+++ b/misc-utils/whereis.c
@@ -55,7 +55,6 @@ void looksrc(char *);
 void lookbin(char *);
 void lookman(char *);
 void findv(char **, int, char *);
-void find(char **, char *);
 void findin(char *, char *);
 int itsit(char *, char *);
 
@@ -321,7 +320,7 @@ void
 looksrc(char *cp)
 {
 	if (Sflag == 0)
-		find(srcdirs, cp);
+		findv(srcdirs, ARRAY_SIZE(srcdirs)-1, cp);
 	else
 		findv(Sflag, Scnt, cp);
 }
@@ -330,7 +329,7 @@ void
 lookbin(char *cp)
 {
 	if (Bflag == 0)
-		find(bindirs, cp);
+		findv(bindirs, ARRAY_SIZE(bindirs)-1, cp);
 	else
 		findv(Bflag, Bcnt, cp);
 }
@@ -339,7 +338,7 @@ void
 lookman(char *cp)
 {
 	if (Mflag == 0)
-		find(mandirs, cp);
+		findv(mandirs, ARRAY_SIZE(mandirs)-1, cp);
 	else
 		findv(Mflag, Mcnt, cp);
 }
@@ -352,13 +351,6 @@ findv(char **dirv, int dirc, char *cp)
 }
 
 void
-find(char **dirs, char *cp)
-{
-	while (*dirs)
-		findin(*dirs++, cp);
-}
-
-void
 findin(char *dir, char *cp)
 {
 	DIR *dirp;
-- 
1.7.4.1

             reply	other threads:[~2011-07-24 23:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-24 23:05 Davidlohr Bueso [this message]
2011-07-26 10:16 ` [PATCH] whereis: remove find() Karel Zak

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=1311548748.3367.14.camel@offbook \
    --to=dave@gnu.org \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /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