diff options
author | Jim Meyering <jim@meyering.net> | 2003-03-22 19:39:40 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-03-22 19:39:40 +0000 |
commit | d777b396b77acb6fb6447793643331da4ef5b6d6 (patch) | |
tree | 248eb2b2f041a0de92131a8a676d44bf6f3adb92 /lib | |
parent | fe2e2b71ead71debb119dff9fc4ae22c46bf9746 (diff) | |
download | coreutils-d777b396b77acb6fb6447793643331da4ef5b6d6.tar.xz |
(NEW_PATTERN): Cast alloca 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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fnmatch_loop.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c index e3450b690..932d907f1 100644 --- a/lib/fnmatch_loop.c +++ b/lib/fnmatch_loop.c @@ -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 CHAR *string, const CHAR *string_end, /* 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; \ |