Module Name:    src
Committed By:   dholland
Date:           Thu Aug 27 01:19:38 UTC 2009

Modified Files:
        src/games/fortune/fortune: fortune.c

Log Message:
Sprinkle some size_t in places where it's better than int.
(Reduces casts.)


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/games/fortune/fortune/fortune.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/fortune/fortune/fortune.c
diff -u src/games/fortune/fortune/fortune.c:1.55 src/games/fortune/fortune/fortune.c:1.56
--- src/games/fortune/fortune/fortune.c:1.55	Thu Aug 27 00:43:31 2009
+++ src/games/fortune/fortune/fortune.c	Thu Aug 27 01:19:38 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fortune.c,v 1.55 2009/08/27 00:43:31 dholland Exp $	*/
+/*	$NetBSD: fortune.c,v 1.56 2009/08/27 01:19:38 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1986, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)fortune.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: fortune.c,v 1.55 2009/08/27 00:43:31 dholland Exp $");
+__RCSID("$NetBSD: fortune.c,v 1.56 2009/08/27 01:19:38 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -116,7 +116,7 @@
 
 static char *Fortbuf = NULL;		/* fortune buffer for -m */
 
-static int Fort_len = 0;
+static size_t Fort_len = 0;
 
 static off_t Seekpts[2];		/* seek pointers to fortunes */
 
@@ -136,7 +136,7 @@
 static void do_free(void *);
 static void *do_malloc(size_t);
 static int form_file_list(char **, int);
-static int fortlen(void);
+static size_t fortlen(void);
 static void get_fort(void);
 static void get_pos(FILEDESC *);
 static void get_tbl(FILEDESC *);
@@ -164,7 +164,7 @@
 static char *conv_pat(char *);
 static int find_matches(void);
 static void matches_in_list(FILEDESC *);
-static int maxlen_in_list(FILEDESC *);
+static size_t maxlen_in_list(FILEDESC *);
 #endif
 
 #ifndef NO_REGEX
@@ -265,7 +265,7 @@
 	if (Wait) {
 		if (Fort_len == 0)
 			(void) fortlen();
-		sleep((unsigned int) max(Fort_len / CPERS, MINW));
+		sleep(max(Fort_len / CPERS, MINW));
 	}
 	return(0);
 }
@@ -308,10 +308,10 @@
  * fortlen:
  *	Return the length of the fortune.
  */
-static int
+static size_t
 fortlen()
 {
-	int	nchar;
+	size_t	nchar;
 	char	line[BUFSIZ];
 
 	if (!(Fortfile->tbl.str_flags & (STR_RANDOM | STR_ORDERED)))
@@ -1330,12 +1330,12 @@
  * maxlen_in_list
  *	Return the maximum fortune len in the file list.
  */
-static int
+static size_t
 maxlen_in_list(list)
 	FILEDESC	*list;
 {
 	FILEDESC	*fp;
-	int		 len, maxlen;
+	size_t len, maxlen;
 
 	maxlen = 0;
 	for (fp = list; fp != NULL; fp = fp->next) {
@@ -1345,7 +1345,7 @@
 		}
 		else {
 			get_tbl(fp);
-			if (fp->tbl.str_longlen > (u_int32_t)maxlen)
+			if (fp->tbl.str_longlen > maxlen)
 				maxlen = fp->tbl.str_longlen;
 		}
 	}

Reply via email to