OSDN Git Service

static initialization removal & K&R-ification
authorkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 May 1999 07:10:41 +0000 (07:10 +0000)
committerkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 May 1999 07:10:41 +0000 (07:10 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@27052 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/fixinc/Makefile.in
gcc/fixinc/fixincl.c
gcc/fixinc/gnu-regex.c
gcc/fixinc/procopen.c
gcc/fixinc/server.c

index 5a20e94..e01e148 100644 (file)
@@ -1,3 +1,13 @@
+Thu May 20 07:06:39 1999  Alexandre Oliva  <aoliva@acm.org>
+
+       * fixinc/Makefile.in(gnu-regex.o): add $(INCLUDES) to compile options
+       * fixinc/fixincl.c(wait_for_pid): K&R-ify arguments
+       (several places): omit static initialization
+       (process): use single fd, since only the read fd is used
+       * fixinc/gnu-regex.c: define 'const' away, if not supported
+       * fixinc/procopen.c(several places): omit static initialization
+       * fixinc/server.c: define 'volitile' away, if not supported
+
 1999-05-20  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
 
        * config/dbxcoff.h (DBX_OUTPUT_MAIN_SOURCE_FILE_END): Use
index 2ba932f..8976c78 100644 (file)
@@ -81,8 +81,8 @@ fixincl: $(OBJ)
        chmod 777 $@ ; fi
 
 gnu-regex.o: gnu-regex.c
-       -$(CC) $(CFLAGS) $(FIXINC_DEFS) -DREGEX_MALLOC -DSTDC_HEADERS=1 \
-               -c $(srcdir)/gnu-regex.c
+       -$(CC) $(CFLAGS) $(FIXINC_DEFS) $(INCLUDES) -DREGEX_MALLOC \
+               -DSTDC_HEADERS=1 -c $(srcdir)/gnu-regex.c
 
 fixincl.o : fixincl.x fixincl.c
 server.o : server.c server.h
index c3da20f..f4cd5ec 100644 (file)
@@ -58,6 +58,13 @@ static const char program_id[] = "fixincl version 1.0";
 #endif
 #define NAME_TABLE_SIZE (MINIMUM_MAXIMUM_LINES * MAXPATHLEN)
 
+#ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+#endif
+#ifndef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
 char *file_name_buf;
 
 #define tSCC static const char
@@ -382,7 +389,9 @@ initialize()
    `waitpid(2)'.  We also ensure that the children exit with success. */
 
 void
-wait_for_pid( pid_t child, int file_name_ct )
+wait_for_pid(child, file_name_ct)
+     pid_t child;
+     int file_name_ct;
 {
   for (;;) {
     int status;
@@ -934,18 +943,20 @@ process (pz_data, pz_file_name)
      char *pz_data;
      const char *pz_file_name;
 {
-  static char env_current_file[1024] = { "file=" };
+  static char env_current_file[1024];
   tFixDesc *p_fixd = fixDescList;
   int todo_ct = FIX_COUNT;
-  t_fd_pair fdp = { -1, -1 };
+  int read_fd = -1;
   int num_children = 0;
 
   /*  IF this is the first time through,
       THEN put the 'file' environment variable into the environment.
            This is used by some of the subject shell scripts and tests.   */
 
-  if (env_current_file[5] == NUL)
+  if (env_current_file[0] == NUL) {
+    strcpy (env_current_file, "file=");
     putenv (env_current_file);
+  }
 
   /*
      Ghastly as it is, this actually updates the value of the variable:
@@ -1059,10 +1070,10 @@ process (pz_data, pz_file_name)
           the first fix.  Any subsequent fixes will use the
           stdout descriptor of the previous fix as its stdin.  */
 
-      if (fdp.read_fd == -1)
+      if (read_fd == -1)
         {
-          fdp.read_fd = open (pz_file_name, O_RDONLY);
-          if (fdp.read_fd < 0)
+          read_fd = open (pz_file_name, O_RDONLY);
+          if (read_fd < 0)
             {
               fprintf (stderr, "Error %d (%s) opening %s\n", errno,
                        strerror (errno), pz_file_name);
@@ -1071,7 +1082,7 @@ process (pz_data, pz_file_name)
         }
 
       /*  This loop should only cycle for 1/2 of one loop.
-          "chain_open" starts a process that uses "fdp.read_fd" as
+          "chain_open" starts a process that uses "read_fd" as
           its stdin and returns the new fd this process will use
           for stdout.  */
 
@@ -1079,14 +1090,14 @@ process (pz_data, pz_file_name)
         {
           tSCC z_err[] = "Error %d (%s) starting filter process for %s\n";
           static int failCt = 0;
-          int fd = chain_open (fdp.read_fd,
+          int fd = chain_open (read_fd,
                                (t_pchar *) p_fixd->patch_args,
                                (process_chain_head == -1)
                                ? &process_chain_head : (pid_t *) NULL);
 
           if (fd != -1)
             {
-              fdp.read_fd = fd;
+              read_fd = fd;
               num_children++;
               break;
             }
@@ -1106,7 +1117,7 @@ process (pz_data, pz_file_name)
   /*  IF after all the tests we did not start any patch programs,
       THEN quit now.   */
 
-  if (fdp.read_fd < 0)
+  if (read_fd < 0)
     return;
 
   /*  OK.  We have work to do.  Read back in the output
@@ -1117,7 +1128,7 @@ process (pz_data, pz_file_name)
       output of the filter chain.
       */
   {
-    FILE *in_fp = fdopen (fdp.read_fd, "r");
+    FILE *in_fp = fdopen (read_fd, "r");
     FILE *out_fp = (FILE *) NULL;
     char *pz_cmp = pz_data;
 
@@ -1173,7 +1184,7 @@ process (pz_data, pz_file_name)
       }
     fclose (in_fp);
   }
-  close (fdp.read_fd);  /* probably redundant, but I'm paranoid */
+  close (read_fd);  /* probably redundant, but I'm paranoid */
 
   /* Wait for child processes created by chain_open()
      to avoid creating zombies.  */
index 84db70f..b24845b 100644 (file)
 
 #else  /* not emacs */
 
+# include "auto-host.h"
+
+# if !defined(const) && !defined(HAVE_CONST)
+#  define const
+# endif
+
+# if !defined(volatile) && !defined(HAVE_VOLATILE)
+#  define volatile
+# endif
+
 /* If we are not linking with Emacs proper,
    we can't use the relocating allocator
    even if config.h says that we can.  */
index 28004ee..00f13b7 100644 (file)
@@ -104,10 +104,12 @@ chain_open (stdin_fd, pp_args, p_child)
      t_pchar *pp_args;
      pid_t *p_child;
 {
-  t_fd_pair stdout_pair = {-1, -1};
+  t_fd_pair stdout_pair;
   pid_t ch_id;
   char *pz_cmd;
 
+  stdout_pair.read_fd = stdout_pair.write_fd = -1;
+
   /*
    *  Create a pipe it will be the child process' stdout,
    *  and the parent will read from it.
index e803e0a..4af40e5 100644 (file)
 #define NUL '\0'
 #endif
 
+#if !defined(volatile) && !defined(HAVE_VOLATILE)
+# define volatile
+#endif
+
 STATIC volatile bool read_pipe_timeout;
 
 static t_pchar def_args[] =