[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bash execute_cmd uses 'long' to count file descriptors; 'int' suffices
From: |
Paul Eggert |
Subject: |
bash execute_cmd uses 'long' to count file descriptors; 'int' suffices |
Date: |
Thu, 12 Apr 2001 17:39:50 -0700 (PDT) |
Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: solaris2.8
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc'
-DCONF_OSTYPE='solaris2.8' -DCONF_MACHTYPE='sparc-sun-solaris2.8'
-DCONF_VENDOR='sun' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
-I/opt/reb/include -g -O2 -Wall
uname output: SunOS shade.twinsun.com 5.8 Generic_108528-06 sun4u sparc
SUNW,Ultra-1
Machine Type: sparc-sun-solaris2.8
Bash Version: 2.05
Patch Level: 0
Release Status: release
Description:
This patch doesn't fix any bugs; it's just a minor coding cleanup.
Bash's struct fd_map uses a 'long' field to count file descriptors.
The rest of the code is inconsistent; sometimes it uses 'long'
and other times (e.g. FD_BITMAP_SIZE, new_bitmap_size) it uses 'int'.
It's more consistent to uniformly use 'int' to count file descriptors,
since they must fit in 'int'.
Repeat-By:
Fix:
2001-04-12 Paul Eggert <eggert@twinsun.com>
* shell.h (struct fd_bitmap.size):
Now int; long is overkill by definition, since this value
counts file descriptors.
* execute_cmd.h (new_fd_bitmap): Accept int, not long.
* execute_cmd.c (new_fd_bitmap): Likewise.
(FD_BITMAP_DEFAULT_SIZE): Now int, not long.
===================================================================
RCS file: RCS/shell.h,v
retrieving revision 2.5.0.1
retrieving revision 2.5.0.2
diff -pu -r2.5.0.1 -r2.5.0.2
--- shell.h 2001/04/11 05:56:29 2.5.0.1
+++ shell.h 2001/04/13 00:32:06 2.5.0.2
@@ -85,7 +85,7 @@ extern int executing, login_shell;
/* Structure to pass around that holds a bitmap of file descriptors
to close, and the size of that structure. Used in execute_cmd.c. */
struct fd_bitmap {
- long size;
+ int size;
char *bitmap;
};
===================================================================
RCS file: RCS/execute_cmd.h,v
retrieving revision 2.5
retrieving revision 2.5.0.1
diff -pu -r2.5 -r2.5.0.1
--- execute_cmd.h 1999/08/05 11:05:25 2.5
+++ execute_cmd.h 2001/04/13 00:32:06 2.5.0.1
@@ -23,7 +23,7 @@
#include "stdc.h"
-extern struct fd_bitmap *new_fd_bitmap __P((long));
+extern struct fd_bitmap *new_fd_bitmap __P((int));
extern void dispose_fd_bitmap __P((struct fd_bitmap *));
extern void close_fd_bitmap __P((struct fd_bitmap *));
extern int executing_line_number __P((void));
===================================================================
RCS file: RCS/execute_cmd.c,v
retrieving revision 2.5
retrieving revision 2.5.0.1
diff -pu -r2.5 -r2.5.0.1
--- execute_cmd.c 2001/03/22 15:17:23 2.5
+++ execute_cmd.c 2001/04/13 00:32:06 2.5.0.1
@@ -194,14 +194,14 @@ SHELL_VAR *this_shell_function;
struct fd_bitmap *current_fds_to_close = (struct fd_bitmap *)NULL;
-#define FD_BITMAP_DEFAULT_SIZE 32L
+#define FD_BITMAP_DEFAULT_SIZE 32
/* Functions to allocate and deallocate the structures used to pass
information from the shell to its children about file descriptors
to close. */
struct fd_bitmap *
new_fd_bitmap (size)
- long size;
+ int size;
{
struct fd_bitmap *ret;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bash execute_cmd uses 'long' to count file descriptors; 'int' suffices,
Paul Eggert <=