I think all of these except perhaps Coproc_id would be better as plain
int not int32_t.
The typedefs could probably die completely (definitely Tflag anyway) but
separate diff.
On Wed, Sep 09, 2015 at 08:27:14PM -0400, Michael McConville wrote:
> I may be totally off base here, but:
>
> INT32's comment suggests that the configure script checks that int is >=
> 32 bits. However, i don't think that script's around anymore, and ANSI
> specifies a minimum of only 16 bits.
>
> The comment also says that INT32 can be 64 bits, but it's then used as
> Tflag, whose comment says it can't be > 32 bits.
>
> Maybe we should just replace it with int32_t?
>
> I also fixed a couple adjacent comment typos.
>
> Index: jobs.c
> ===================================================================
> RCS file: /cvs/src/bin/ksh/jobs.c,v
> retrieving revision 1.41
> diff -u -p -r1.41 jobs.c
> --- jobs.c 18 Apr 2015 18:28:36 -0000 1.41
> +++ jobs.c 10 Sep 2015 00:06:59 -0000
> @@ -71,7 +71,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 */
> + int32_t age; /* number of jobs started */
> struct timeval systime; /* system time used by job */
> struct timeval usrtime; /* user time used by job */
> Proc *proc_list; /* process list */
> @@ -111,7 +111,7 @@ static Job *async_job;
> static pid_t async_pid;
>
> static int nzombie; /* # of zombies owned by this process */
> -INT32 njobs; /* # of jobs started */
> +int32_t njobs; /* # of jobs started */
> static int child_max; /* CHILD_MAX */
>
>
> Index: sh.h
> ===================================================================
> RCS file: /cvs/src/bin/ksh/sh.h,v
> retrieving revision 1.33
> diff -u -p -r1.33 sh.h
> --- sh.h 18 Dec 2013 13:53:12 -0000 1.33
> +++ sh.h 10 Sep 2015 00:06:59 -0000
> @@ -28,12 +28,6 @@
>
> #include <paths.h>
>
> -/* 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.
> - */
> -# define INT32 int
> -
> /* end of common headers */
>
> /* some useful #defines */
> @@ -52,8 +46,8 @@
> #define sizeofN(type, n) (sizeof(type) * (n))
> #define BIT(i) (1<<(i)) /* define bit in flag */
>
> -/* Table flag type - needs > 16 and < 32 bits */
> -typedef INT32 Tflag;
> +/* Table flag type - needs >= 16 and <= 32 bits */
> +typedef int32_t Tflag;
>
> #define NUFILE 32 /* Number of user-accessible files */
> #define FDBASE 10 /* First file usable by Shell */
> @@ -353,7 +347,7 @@ EXTERN Getopt user_opt; /* parsing stat
>
> /* This for co-processes */
>
> -typedef INT32 Coproc_id; /* something that won't (realisticly) wrap */
> +typedef int32_t Coproc_id; /* something that won't (realistically) wrap */
> struct coproc {
> int read; /* pipe from co-process's stdout */
> int readw; /* other side of read (saved temporarily) */
>