[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: alloca function use discouraged
From: |
Conrad T. Pino |
Subject: |
RE: alloca function use discouraged |
Date: |
Thu, 15 Apr 2004 08:15:39 -0700 |
Hi Derek,
> From: Derek Robert Price [mailto:derek@ximbiot.com]
>
> It does look like the GNULIB alloca_.h is trying to use the MSC
> version of _alloca, however:
>
> # ifdef _MSC_VER
> # include <malloc.h>
> # define alloca _alloca
> # endif
>
> This should mean that the alloca.c module is not required to be
> compile on Windows, so I don't know why you had to add it to get
> fnmatch to compile, if you want to look into this and fix it. Perhaps
> HAVE_ALLOCA_H needs be defined in windows-NT/config.h.in?
I was using "grep" to locate "alloca" references and spotted that too.
I'll look into (1) if "_MSC_VER" is defined and (2) if so which module
missed the boat.
> Derek
Conrad
grep -dno "[^a-zA-Z0-9_]+alloca[^a-zA-Z0-9_]" *.h *.c
lib\alloca_.h 26 /* alloca(N) returns a pointer (void* or char*) to N
bytes of memory
lib\alloca_.h 28 Use of alloca should be avoided:
lib\alloca_.h 39 # define alloca __builtin_alloca
lib\alloca_.h 44 # define alloca _alloca
lib\alloca_.h 47 # include <alloca.h>
lib\alloca_.h 54 extern "C" void *alloca (unsigned int);
lib\alloca_.h 56 extern void *alloca ();
lib\alloca_.h 60 extern char *alloca ();
lib\alloca.c 1 /* alloca.c -- allocate automatically reclaimed memory
lib\alloca.c 4 This implementation of the PWB library alloca function,
lib\alloca.c 15 track of all alloca-allocated blocks, and reclaim any
lib\alloca.c 20 As a special case, alloca(0) reclaims storage without
lib\alloca.c 21 allocating any. It is a good idea to use alloca(0) in
lib\alloca.c 45 /* If someone has defined alloca as a macro,
lib\alloca.c 46 there must be some other way alloca is supposed to
work. */
lib\alloca.c 120 /* An "alloca header" is used to:
lib\alloca.c 121 (a) chain together all alloca'ed blocks;
lib\alloca.c 141 static header *last_alloca_header = NULL; /* -> last
alloca header. */
lib\alloca.c 145 the procedure that called alloca. Originally, this
space
lib\alloca.c 161 /* Reclaim garbage, defined as all alloca'd storage that
lib\alloca.c 412 for alloca. */
lib\alloca.c 488 # endif /* no alloca */
lib\fnmatch.c 28 # define alloca __builtin_alloca
lib\fnmatch.c 32 # include <alloca.h>
lib\fnmatch.c 38 char *alloca ();
lib\fnmatch.c 363 wpattern = (wchar_t *) alloca (totsize * sizeof
(wchar_t));
lib\fnmatch_loop.c 1063 newp = (struct patternlist *) alloca
(newpsize); \
lib\getdate.c 79 We don't want to mess with all the portability
hassles of alloca.
lib\getdate.c 80 In particular, most (all?) versions of bison will use
alloca in
lib\getdate.c 84 parser. I played with adding "#define alloca
dont_use_alloca", to
lib\getdate.c 85 give an error if the parser generator uses alloca
(and thus detect
lib\regex.c 256 /* Should we use malloc or alloca? If REGEX_MALLOC is not
defined, we
lib\regex.c 257 use `alloca' instead of `malloc'. This is because
using malloc in
lib\regex.c 262 Because we sometimes use alloca, some routines have to
be macros,
lib\regex.c 263 not functions -- `alloca'-allocated space disappears at
the end of the
lib\regex.c 274 /* Emacs already defines alloca, sometimes. */
lib\regex.c 277 /* Make alloca work the best possible way. */
lib\regex.c 279 # define alloca __builtin_alloca
lib\regex.c 282 # include <alloca.h>
lib\regex.c 286 # endif /* not alloca */
lib\regex.c 292 (destination = (char *) alloca (nsize),
\
lib\regex.c 295 /* No need to do anything to free, after alloca. */
lib\regex.c 1377 /* Avoiding alloca during matching, to placate r_alloc. */
lib\regex.c 1380 searching and matching functions should not call
alloca. On some
lib\regex.c 1381 systems, alloca is implemented in terms of malloc, and
if we're
lib\regex.c 1399 /* When using GNU C, we are not REALLY using the C alloca,
no matter
lib\regex.c 4184 isn't necessary unless we're trying to avoid calling
alloca in
lib\regex.c 5219 alloca (0);
lib\regex.c 5417 alloca (0);
lib\regex.c 5476 alloca (0);
lib\regex.c 5534 /* This is a separate function so that we can force an
alloca cleanup
lib\vasnprintf.c 29 # include <alloca.h>
lib\vasnprintf.c 151 buf = (CHAR_T *) alloca (buf_neededlength *
sizeof (CHAR_T));
vms\config.h 151 /* Define to force lib/regex.c to use malloc instead of
alloca. */
vms\ndir.c 43 /* The following was snarfed from lib-src/alloca.c in GNU
Emacs,
vms\ndir.c 55 malloc. The Emacs executable needs alloca to call
xmalloc, because
vms\ndir.c 57 hand, the utilities in lib-src need alloca to call
malloc; some of
- alloca function use discouraged, Conrad T. Pino, 2004/04/15
- Re: alloca function use discouraged, Derek Robert Price, 2004/04/15
- RE: alloca function use discouraged,
Conrad T. Pino <=
- RE: alloca function use discouraged, Conrad T. Pino, 2004/04/15
- Re: alloca function use discouraged, Derek Robert Price, 2004/04/15
- RE: alloca function use discouraged, Conrad T. Pino, 2004/04/15
- Re: alloca function use discouraged, Derek Robert Price, 2004/04/15
- RE: alloca function use discouraged, Conrad T. Pino, 2004/04/15
- Re: alloca function use discouraged, Derek Robert Price, 2004/04/15