Here's YA reason for a unified library.  I found a problem while working
on cygcheck.  AFAICT, my code was correct but gcc was miscompiling it,
ending up with a value of 'p' which was not a pointer.

The code below fixes that problem.

Does this look ok?  It seems to do the right thing in cygcheck.

cgf

2001-11-11  Christopher Faylor  <[EMAIL PROTECTED]>

        * choose.cc (parse_filename): Reorganize code to work around gcc
        optimization problem.

Index: choose.cc
===================================================================
RCS file: /cvs/uberbaum/winsup/cinstall/choose.cc,v
retrieving revision 2.65
diff -u -p -r2.65 choose.cc
--- choose.cc   2001/11/09 23:37:22     2.65
+++ choose.cc   2001/11/11 06:00:52
@@ -1340,21 +1340,21 @@ parse_filename (const char *in_fn, filep
 
   if (!f.what[0])
     {
+      int n;
       p = strchr (ver, '\0');
       strcpy (f.pkgtar, in_fn);
       if ((p -= 4) >= ver && strcasecmp (p, "-src") == 0)
-       {
-         strcpy (f.what, "src");
-         *p = '\0';
-         p = f.pkgtar + (p - fn) + 4;
-         memcpy (p - 4, p, strlen (p));
-       }
+       n = 4;
       else if ((p -= 2) >= ver && strcasecmp (p, "-patch") == 0)
+       n = 6;
+      else
+       n = 0;
+      if (n)
        {
-         strcpy (f.what, "patch");
+         strcpy (f.what, p + 1);
          *p = '\0';
-         p = f.pkgtar + (p - fn) + 6;
-         memcpy (p - 6, p, strlen (p));
+         p = f.pkgtar + (p - fn) + n;
+         memmove (p - 4, p, strlen (p));
        }
     }
 

Reply via email to