aboutsummaryrefslogtreecommitdiff
path: root/libiberty/getopt.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2005-05-24 21:01:33 +0000
committerDJ Delorie <dj@redhat.com>2005-05-24 21:01:33 +0000
commitabf6a75b428517d9caaf9155212b0b10e0379a99 (patch)
tree3476694dba1d2c731deb2a131b0d8d6c5dcb0cd3 /libiberty/getopt.c
parentf127898a4db12540b9898e25777c6c3725d119bf (diff)
downloadgdb-abf6a75b428517d9caaf9155212b0b10e0379a99.zip
gdb-abf6a75b428517d9caaf9155212b0b10e0379a99.tar.gz
gdb-abf6a75b428517d9caaf9155212b0b10e0379a99.tar.bz2
merge from gcc
Diffstat (limited to 'libiberty/getopt.c')
-rw-r--r--libiberty/getopt.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libiberty/getopt.c b/libiberty/getopt.c
index d09ce5a..0b5c2e8 100644
--- a/libiberty/getopt.c
+++ b/libiberty/getopt.c
@@ -212,8 +212,16 @@ static char *posixly_correct;
/* Avoid depending on library functions or files
whose names are inconsistent. */
-#ifndef getenv
-extern char *getenv ();
+#if HAVE_STDLIB_H && HAVE_DECL_GETENV
+# include <stdlib.h>
+#elif !defined(getenv)
+# ifdef __cplusplus
+extern "C" {
+# endif /* __cplusplus */
+extern char *getenv (const char *);
+# ifdef __cplusplus
+}
+# endif /* __cplusplus */
#endif
static char *
@@ -325,7 +333,7 @@ exchange (char **argv)
{
/* We must extend the array. The user plays games with us and
presents new arguments. */
- char *new_str = malloc (top + 1);
+ char *new_str = (char *) malloc (top + 1);
if (new_str == NULL)
nonoption_flags_len = nonoption_flags_max_len = 0;
else