Changeset 2596 for vendor/gnumake/current/ar.c
- Timestamp:
- Jun 20, 2012, 12:44:52 AM (13 years ago)
- Location:
- vendor/gnumake/current
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/gnumake/current
- Property svn:ignore deleted
-
vendor/gnumake/current/ar.c
r1989 r2596 1 1 /* Interface to `ar' archives for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software 4 Foundation, Inc. 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 6 This file is part of GNU Make. 6 7 … … 25 26 #include <fnmatch.h> 26 27 27 /* Return nonzero if NAME is an archive-member reference, zero if not. 28 An archive-member reference is a name like `lib(member)'. 28 /* Return nonzero if NAME is an archive-member reference, zero if not. An 29 archive-member reference is a name like `lib(member)' where member is a 30 non-empty string. 29 31 If a name like `lib((entry))' is used, a fatal error is signaled at 30 32 the attempt to use this unsupported feature. */ … … 40 42 41 43 end = p + strlen (p) - 1; 42 if (*end != ')' )44 if (*end != ')' || end == p + 1) 43 45 return 0; 44 46 … … 199 201 { 200 202 /* We have a match. Add it to the chain. */ 201 struct nameseq *new = xmalloc (state->size); 202 memset (new, '\0', state->size); 203 new->name = strcache_add (concat (state->arname, mem, ")")); 203 struct nameseq *new = xcalloc (state->size); 204 new->name = strcache_add (concat (4, state->arname, "(", mem, ")")); 204 205 new->next = state->chain; 205 206 state->chain = new; … … 216 217 { 217 218 const char *p; 218 int open = 0;219 int opened = 0; 219 220 220 221 for (p = pattern; *p != '\0'; ++p) … … 231 232 232 233 case '[': 233 open = 1;234 opened = 1; 234 235 break; 235 236 236 237 case ']': 237 if (open )238 if (opened) 238 239 return 1; 239 240 break; … … 252 253 struct nameseq *n; 253 254 const char **names; 254 char *name;255 255 unsigned int i; 256 256 … … 260 260 /* Scan the archive for matches. 261 261 ar_glob_match will accumulate them in STATE.chain. */ 262 i = strlen (arname); 263 name = alloca (i + 2); 264 memcpy (name, arname, i); 265 name[i] = '('; 266 name[i + 1] = '\0'; 267 state.arname = name; 262 state.arname = arname; 268 263 state.pattern = member_pattern; 269 264 state.size = size; … … 282 277 283 278 /* Sort them alphabetically. */ 284 qsort (names, i, sizeof (*names), alpha_compare); 279 /* MSVC erroneously warns without a cast here. */ 280 qsort ((void *)names, i, sizeof (*names), alpha_compare); 285 281 286 282 /* Put them back into the chain in the sorted order. */
Note:
See TracChangeset
for help on using the changeset viewer.