Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/makemandb Avoid a call to strncmp when comparing on...



details:   https://anonhg.NetBSD.org/src/rev/92cc3cc3be10
branches:  trunk
changeset: 823635:92cc3cc3be10
user:      abhinav <abhinav%NetBSD.org@localhost>
date:      Sun Apr 30 08:41:18 2017 +0000

description:
Avoid a call to strncmp when comparing only the first character of the string.

diffstat:

 usr.sbin/makemandb/makemandb.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 52dee592d083 -r 92cc3cc3be10 usr.sbin/makemandb/makemandb.c
--- a/usr.sbin/makemandb/makemandb.c    Sat Apr 29 23:00:42 2017 +0000
+++ b/usr.sbin/makemandb/makemandb.c    Sun Apr 30 08:41:18 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: makemandb.c,v 1.49 2017/04/29 16:49:51 abhinav Exp $   */
+/*     $NetBSD: makemandb.c,v 1.50 2017/04/30 08:41:18 abhinav Exp $   */
 /*
  * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
  * Copyright (c) 2011 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
@@ -17,7 +17,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: makemandb.c,v 1.49 2017/04/29 16:49:51 abhinav Exp $");
+__RCSID("$NetBSD: makemandb.c,v 1.50 2017/04/30 08:41:18 abhinav Exp $");
 
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -519,7 +519,7 @@
 
                while ((dirp = readdir(dp)) != NULL) {
                        /* Avoid . and .. entries in a directory */
-                       if (strncmp(dirp->d_name, ".", 1)) {
+                       if (dirp->d_name[0] != '.') {
                                easprintf(&buf, "%s/%s", file, dirp->d_name);
                                traversedir(parent, buf, db, mp);
                                free(buf);



Home | Main Index | Thread Index | Old Index