Re: [HACKERS] patches now that 6.3 has been released - Mailing list pgsql-hackers

From Michael Meskes
Subject Re: [HACKERS] patches now that 6.3 has been released
Date
Msg-id 199803031331.OAA17235@gauss.topsystem.de
Whole thread Raw
In response to Re: [HACKERS] patches now that 6.3 has been released  (The Hermit Hacker <scrappy@hub.org>)
List pgsql-hackers
The Hermit Hacker writes:
>     Over time, it gets slightly harder, but if you can, make it a
> seperate patch that we can add to the ftp server itself and that ppl can
> download. (and, of course, add it in for v6.4 *grin*)

Okay, here's the missing bug fix of two minor bugs. I hope I don't have to
keep both source trees from now on. :-)

diff -rcN interfaces/ecpg/preproc/ecpg.c interfaces/ecpg.mm/preproc/ecpg.c
*** interfaces/ecpg/preproc/ecpg.c    Tue Mar  3 08:29:49 1998
--- interfaces/ecpg.mm/preproc/ecpg.c    Tue Mar  3 11:52:45 1998
***************
*** 58,108 ****
          /* after the options there must not be anything but filenames */
          for (fnr = optind; fnr < argc; fnr++)
          {
!             char       *filename,
!                        *ptr2ext;
!             int            ext = 0;

!             filename = mm_alloc(strlen(argv[fnr]) + 4);

!             strcpy(filename, argv[fnr]);

!             ptr2ext = strrchr(filename, '.');
!             /* no extension or extension not equal .pgc */
!             if (ptr2ext == NULL || strcmp(ptr2ext, ".pgc") != 0)
              {
!                 if (ptr2ext == NULL)
!                     ext = 1;    /* we need this information a while later */
!                 ptr2ext = filename + strlen(filename);
                  ptr2ext[0] = '.';
              }

-             /* make extension = .c */
-             ptr2ext[1] = 'c';
-             ptr2ext[2] = '\0';
-
              if (out_option == 0)/* calculate the output name */
              {
!                 yyout = fopen(filename, "w");
                  if (yyout == NULL)
                  {
!                     perror(filename);
!                     free(filename);
                      continue;
                  }
              }

-             if (ext == 1)
-             {
-                 /* no extension => add .pgc */
-                 ptr2ext = strrchr(filename, '.');
-                 ptr2ext[1] = 'p';
-                 ptr2ext[2] = 'g';
-                 ptr2ext[3] = 'c';
-                 ptr2ext[4] = '\0';
-                 input_filename = filename;
-             }
-             else
-                 input_filename = argv[fnr];
              yyin = fopen(input_filename, "r");
              if (yyin == NULL)
                  perror(argv[fnr]);
--- 58,102 ----
          /* after the options there must not be anything but filenames */
          for (fnr = optind; fnr < argc; fnr++)
          {
!             char       *output_filename, *ptr2ext;

!             input_filename = mm_alloc(strlen(argv[fnr]) + 5);

!             strcpy(input_filename, argv[fnr]);

!             ptr2ext = strrchr(input_filename, '.');
!             /* no extension? */
!             if (ptr2ext == NULL)
              {
!                 ptr2ext = input_filename + strlen(input_filename);
!
!                 /* no extension => add .pgc */
                  ptr2ext[0] = '.';
+                 ptr2ext[1] = 'p';
+                 ptr2ext[2] = 'g';
+                 ptr2ext[3] = 'c';
+                 ptr2ext[4] = '\0';
              }

              if (out_option == 0)/* calculate the output name */
              {
!                 output_filename = strdup(input_filename);
!
!                 ptr2ext = strrchr(output_filename, '.');
!                 /* make extension = .c */
!                 ptr2ext[1] = 'c';
!                 ptr2ext[2] = '\0';
!
!                 yyout = fopen(output_filename, "w");
                  if (yyout == NULL)
                  {
!                     perror(output_filename);
!                     free(output_filename);
!                     free(input_filename);
                      continue;
                  }
              }

              yyin = fopen(input_filename, "r");
              if (yyin == NULL)
                  perror(argv[fnr]);
***************
*** 122,128 ****
                      fclose(yyout);
              }

!             free(filename);
          }
      }
      return (0);
--- 116,123 ----
                      fclose(yyout);
              }

!             free(output_filename);
!             free(input_filename);
          }
      }
      return (0);
diff -rcN interfaces/ecpg/preproc/preproc.y interfaces/ecpg.mm/preproc/preproc.y
*** interfaces/ecpg/preproc/preproc.y    Tue Mar  3 08:29:49 1998
--- interfaces/ecpg.mm/preproc/preproc.y    Fri Feb 27 16:56:12 1998
***************
*** 607,613 ****
  /* FIXME: instead of S_SYMBOL we should list all possible commands */
  sqlcommand : S_SYMBOL | SQL_DECLARE;

! sqlstatement_words : sqlstatement_word
             | sqlstatement_words sqlstatement_word;

  sqlstatement_word : ':' symbol
--- 607,613 ----
  /* FIXME: instead of S_SYMBOL we should list all possible commands */
  sqlcommand : S_SYMBOL | SQL_DECLARE;

! sqlstatement_words : /* empty */
             | sqlstatement_words sqlstatement_word;

  sqlstatement_word : ':' symbol
diff -rcN interfaces/ecpg/test/perftest.pgc interfaces/ecpg.mm/test/perftest.pgc
*** interfaces/ecpg/test/perftest.pgc    Tue Mar  3 08:29:49 1998
--- interfaces/ecpg.mm/test/perftest.pgc    Fri Feb 27 17:01:39 1998
***************
*** 16,21 ****
--- 16,22 ----
          usec+=1000000;
      }
      printf("I needed %ld seconds and %ld microseconds for the %s test.\n", sec, usec, text);
+     exec sql vacuum;
  }

  int
***************
*** 106,113 ****
      exec sql drop index number1;

      exec sql drop table perftest1;
-
-     exec sql commit;

      return (0);
  }
--- 107,112 ----


Michael

--
Dr. Michael Meskes, Project-Manager    | topsystem Systemhaus GmbH
meskes@topsystem.de                    | Europark A2, Adenauerstr. 20
meskes@debian.org                      | 52146 Wuerselen
Go SF49ers! Go Rhein Fire!             | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux!                  | Fax: (+49) 2405/4670-10

pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] PostgreSQL - the Linux of Databases...
Next
From: Zeugswetter Andreas SARZ
Date:
Subject: text should be a blob field