Module Name:    src
Committed By:   kamil
Date:           Fri Jun 23 00:29:42 UTC 2017

Modified Files:
        src/bin/ksh: config.h jobs.c sh.h

Log Message:
ksh: Replace homegrown int_least32_t with the C99 version


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/bin/ksh/config.h
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/jobs.c
cvs rdiff -u -r1.28 -r1.29 src/bin/ksh/sh.h

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

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.36 src/bin/ksh/config.h:1.37
--- src/bin/ksh/config.h:1.36	Fri Jun 23 00:20:22 2017
+++ src/bin/ksh/config.h	Fri Jun 23 00:29:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.36 2017/06/23 00:20:22 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.37 2017/06/23 00:29:42 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -172,12 +172,6 @@
 /* Include game-of-life? */
 /* #undef SILLY */
 
-/* The number of bytes in a int.  */
-#define SIZEOF_INT 4
-
-/* The number of bytes in a long.  */
-#define SIZEOF_LONG 4
-
 /* Define if you have the _setjmp function.  */
 #define HAVE__SETJMP
 

Index: src/bin/ksh/jobs.c
diff -u src/bin/ksh/jobs.c:1.13 src/bin/ksh/jobs.c:1.14
--- src/bin/ksh/jobs.c:1.13	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/jobs.c	Fri Jun 23 00:29:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.13 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: jobs.c,v 1.14 2017/06/23 00:29:42 kamil Exp $	*/
 
 /*
  * Process and job control
@@ -26,7 +26,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: jobs.c,v 1.13 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.14 2017/06/23 00:29:42 kamil Exp $");
 #endif
 
 
@@ -142,7 +142,7 @@ struct job {
 	int	status;		/* exit status of last process */
 	pid_t	pgrp;		/* process group of job */
 	pid_t	ppid;		/* pid of process that forked job */
-	INT32	age;		/* number of jobs started */
+	int_least32_t	age;	/* number of jobs started */
 	clock_t	systime;	/* system time used by job */
 	clock_t	usrtime;	/* user time used by job */
 	Proc	*proc_list;	/* process list */
@@ -183,7 +183,7 @@ static Job		*async_job;
 static pid_t		async_pid;
 
 static int		nzombie;	/* # of zombies owned by this process */
-static INT32		njobs;		/* # of jobs started */
+static int_least32_t	njobs;		/* # of jobs started */
 static int		child_max;	/* CHILD_MAX */
 
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.28 src/bin/ksh/sh.h:1.29
--- src/bin/ksh/sh.h:1.28	Fri Jun 23 00:18:01 2017
+++ src/bin/ksh/sh.h	Fri Jun 23 00:29:42 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.28 2017/06/23 00:18:01 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.29 2017/06/23 00:29:42 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.28 2017/06/23 00:18:01 kamil Exp $ */
+/* $Id: sh.h,v 1.29 2017/06/23 00:29:42 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -26,6 +26,7 @@
 #include <stdarg.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <stdint.h>
 
 #ifndef O_ACCMODE
 # define O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
@@ -118,20 +119,6 @@ typedef	RETSIGTYPE (*handler_t) ARGS((in
 # define ksh_jmp_buf		jmp_buf
 #endif /* HAVE_SIGSETJMP */
 
-/* Find a integer type that is at least 32 bits (or die) - SIZEOF_* defined
- * by autoconf (assumes an 8 bit byte, but I'm not concerned).
- * NOTE: INT32 may end up being more than 32 bits.
- */
-#if SIZEOF_INT >= 4
-# define INT32	int
-#else /* SIZEOF_INT */
-# if SIZEOF_LONG >= 4
-#  define INT32	long
-# else /* SIZEOF_LONG */
-   #error cannot find 32 bit type...
-# endif /* SIZEOF_LONG */
-#endif /* SIZEOF_INT */
-
 /* end of common headers */
 
 /* Stop gcc and lint from complaining about possibly uninitialized variables */
@@ -187,7 +174,7 @@ typedef int bool_t;
 #define	BIT(i)	(1<<(i))	/* define bit in flag */
 
 /* Table flag type - needs > 16 and < 32 bits */
-typedef INT32 Tflag;
+typedef int_least32_t Tflag;
 
 #define	NUFILE	32		/* Number of user-accessible files */
 #define	FDBASE	10		/* First file usable by Shell */
@@ -495,7 +482,7 @@ EXTERN Getopt user_opt;		/* parsing stat
 #ifdef KSH
 /* This for co-processes */
 
-typedef INT32 Coproc_id; /* something that won't (realisticly) wrap */
+typedef int_least32_t Coproc_id; /* something that won't (realisticly) wrap */
 struct coproc {
 	int	read;		/* pipe from co-process's stdout */
 	int	readw;		/* other side of read (saved temporarily) */

Reply via email to