From f4b0e187e9362a68cbe79ee680259138171a7507 Mon Sep 17 00:00:00 2001 From: kristerw Date: Fri, 30 May 2003 23:08:12 +0000 Subject: [PATCH] Fix some lint warnings. --- usr.bin/patch/backupfile.c | 23 +++++++++-------------- usr.bin/patch/patch.c | 9 +++++---- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/usr.bin/patch/backupfile.c b/usr.bin/patch/backupfile.c index ade0f6156003..599f75bf938f 100644 --- a/usr.bin/patch/backupfile.c +++ b/usr.bin/patch/backupfile.c @@ -1,4 +1,4 @@ -/* $NetBSD: backupfile.c,v 1.9 2002/03/16 22:36:42 kristerw Exp $ */ +/* $NetBSD: backupfile.c,v 1.10 2003/05/30 23:08:12 kristerw Exp $ */ /* backupfile.c -- make Emacs style backup file names Copyright (C) 1990 Free Software Foundation, Inc. @@ -15,7 +15,7 @@ #include #ifndef lint -__RCSID("$NetBSD: backupfile.c,v 1.9 2002/03/16 22:36:42 kristerw Exp $"); +__RCSID("$NetBSD: backupfile.c,v 1.10 2003/05/30 23:08:12 kristerw Exp $"); #endif /* not lint */ #include @@ -44,13 +44,7 @@ __RCSID("$NetBSD: backupfile.c,v 1.9 2002/03/16 22:36:42 kristerw Exp $"); #include -#if defined (_POSIX_VERSION) -/* POSIX does not require that the d_ino field be present, and some - systems do not provide it. */ -#define REAL_DIR_ENTRY(dp) 1 -#else -#define REAL_DIR_ENTRY(dp) ((dp)->d_ino != 0) -#endif +#define REAL_DIR_ENTRY(dp) ((dp)->d_fileno != 0) /* Which type of backup file names are generated. */ enum backup_type backup_type = none; @@ -62,7 +56,7 @@ char *simple_backup_suffix = "~"; /* backupfile.c */ static int max_backup_version(char *, char *); static char *make_version_name(char *, int); -static int version_number(char *, char *, int); +static int version_number(char *, char *, size_t); static char *concat(char *, char *); static char *dirname(char *); static int argmatch(char *, char **); @@ -111,7 +105,7 @@ max_backup_version(char *file, char *dir) struct direct *dp; int highest_version; int this_version; - int file_name_length; + size_t file_name_length; dirp = opendir (dir); if (!dirp) @@ -151,7 +145,7 @@ make_version_name(char *file, int version) BASE should already have ".~" appended to it. */ static int -version_number(char *base, char *backup, int base_length) +version_number(char *base, char *backup, size_t base_length) { int version; char *p; @@ -202,7 +196,7 @@ dirname(char *path) { char *newpath; char *slash; - int length; /* Length of result, not including NUL. */ + size_t length; /* Length of result, not including NUL. */ slash = strrchr (path, '/'); if (slash == 0) @@ -234,7 +228,7 @@ static int argmatch(char *arg, char **optlist) { int i; /* Temporary index in OPTLIST. */ - int arglen; /* Length of ARG. */ + size_t arglen; /* Length of ARG. */ int matchind = -1; /* Index of first nonexact match. */ int ambiguous = 0; /* If nonzero, multiple nonexact match(es). */ @@ -303,4 +297,5 @@ get_version(char *version) return backup_types[i]; invalid_arg ("version control type", version, i); exit (1); + /* NOTREACHED */ } diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c index cdb9aa8ee1fd..b8a7d0398913 100644 --- a/usr.bin/patch/patch.c +++ b/usr.bin/patch/patch.c @@ -1,4 +1,4 @@ -/* $NetBSD: patch.c,v 1.16 2003/05/30 22:33:58 kristerw Exp $ */ +/* $NetBSD: patch.c,v 1.17 2003/05/30 23:08:13 kristerw Exp $ */ /* patch - a program to apply diffs to original files * @@ -25,7 +25,7 @@ #include #ifndef lint -__RCSID("$NetBSD: patch.c,v 1.16 2003/05/30 22:33:58 kristerw Exp $"); +__RCSID("$NetBSD: patch.c,v 1.17 2003/05/30 23:08:13 kristerw Exp $"); #endif /* not lint */ #include "INTERN.h" @@ -55,7 +55,7 @@ static void copy_till(LINENUM); static void spew_output(void); static void dump_line(LINENUM); static bool patch_match(LINENUM, LINENUM, LINENUM); -static bool similar(char *, char *, int); +static bool similar(char *, char *, size_t); int main(int, char *[]); /* TRUE if -E was specified on command line. */ @@ -321,6 +321,7 @@ main(int argc, char *argv[]) set_signals(1); } my_exit(failtotal); + /* NOTREACHED */ } /* Prepare to find the next patch to do in the patch file. */ @@ -871,7 +872,7 @@ patch_match(LINENUM base, LINENUM offset, LINENUM fuzz) /* Do two lines match with canonicalized white space? */ static bool -similar(char *a, char *b, int len) +similar(char *a, char *b, size_t len) { while (len) { if (isspace((unsigned char)*b)) {/* whitespace (or \n) to match? */