bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnulib] fnmatch merge from coreutils


From: Paul Eggert
Subject: [Bug-gnulib] fnmatch merge from coreutils
Date: 04 Aug 2003 16:27:32 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

I installed this patch, taken from coreutils.

2003-08-04  Paul Eggert  <address@hidden>

        Merge from coreutils.
        * fnmatch_.h (__const): Remove.  Use 'const'.
        * fnmatch_loop.c (NEW_PATTERN): Cast alloca return value to proper type.
        Otherwise, it wouldn't compile with at least /bin/cc on
        ymp-cray-unicos9.0.2.X.
        Combine two mostly-identical uses of alloca into one.
        Thanks to the Cray-Cyber project for access to a Cray Y-MP.

Index: fnmatch_.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/fnmatch_.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -p -u -r1.1 -r1.2
--- fnmatch_.h  22 Jun 2002 08:55:43 -0000      1.1
+++ fnmatch_.h  4 Aug 2003 23:22:47 -0000       1.2
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002
+/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -35,10 +35,6 @@ extern "C" {
    non-ANSI C where `const' is problematical.  */
 # endif /* C++ or ANSI C.  */
 
-# ifndef __const
-#  define __const const
-# endif
-
 /* We #undef these before defining them because some losing systems
    (HP-UX A.08.07 for example) define these in <unistd.h>.  */
 # undef        FNM_PATHNAME
@@ -70,7 +66,7 @@ extern "C" {
 
 /* Match NAME against the filename pattern PATTERN,
    returning zero if it matches, FNM_NOMATCH if not.  */
-extern int fnmatch __P ((__const char *__pattern, __const char *__name,
+extern int fnmatch __P ((const char *__pattern, const char *__name,
                         int __flags));
 
 # ifdef        __cplusplus
Index: fnmatch_loop.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/fnmatch_loop.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -p -u -r1.2 -r1.3
--- fnmatch_loop.c      26 Jun 2002 06:17:52 -0000      1.2
+++ fnmatch_loop.c      4 Aug 2003 23:23:27 -0000       1.3
@@ -1,5 +1,5 @@
 /* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, 2001,
-   2002 Free Software Foundation, Inc.
+   2002, 2003 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -1051,13 +1051,14 @@ EXT (INT opt, const CHAR *pattern, const
            /* This means we found the end of the pattern.  */
 #define NEW_PATTERN \
            struct patternlist *newp;                                         \
+           size_t plen;                                                      \
                                                                              \
-           if (opt == L('?') || opt == L('@'))                               \
-             newp = alloca (offsetof (struct patternlist, str)               \
-                            + (pattern_len * sizeof (CHAR)));                \
-           else                                                              \
-             newp = alloca (offsetof (struct patternlist, str)               \
-                            + ((p - startp + 1) * sizeof (CHAR)));           \
+           plen = (opt == L('?') || opt == L('@')                            \
+                   ? pattern_len                                             \
+                   : p - startp + 1);                                        \
+           newp = (struct patternlist *)                                     \
+             alloca (offsetof (struct patternlist, str)                      \
+                     + (plen * sizeof (CHAR)));                              \
            *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L('\0');    \
            newp->next = NULL;                                                \
            *lastp = newp;                                                    \




reply via email to

[Prev in Thread] Current Thread [Next in Thread]