Source-Changes-HG archive

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

[src/trunk]: src/games/fortune/fortune Sprinkle some size_t in places where i...



details:   https://anonhg.NetBSD.org/src/rev/c19e027d8bbf
branches:  trunk
changeset: 747002:c19e027d8bbf
user:      dholland <dholland%NetBSD.org@localhost>
date:      Thu Aug 27 01:19:38 2009 +0000

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

diffstat:

 games/fortune/fortune/fortune.c |  22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diffs (91 lines):

diff -r 9b18adeff010 -r c19e027d8bbf games/fortune/fortune/fortune.c
--- a/games/fortune/fortune/fortune.c   Thu Aug 27 00:43:31 2009 +0000
+++ b/games/fortune/fortune/fortune.c   Thu Aug 27 01:19:38 2009 +0000
@@ -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;
                }
        }



Home | Main Index | Thread Index | Old Index