summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/libiberty/getpwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/binutils/libiberty/getpwd.c')
-rw-r--r--contrib/binutils/libiberty/getpwd.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/contrib/binutils/libiberty/getpwd.c b/contrib/binutils/libiberty/getpwd.c
index 31c7d20..fa5c132 100644
--- a/contrib/binutils/libiberty/getpwd.c
+++ b/contrib/binutils/libiberty/getpwd.c
@@ -39,10 +39,6 @@ extern int errno;
#include <limits.h>
#endif
-/* Prototype these in case the system headers don't provide them. */
-extern char *getpwd ();
-extern char *getwd ();
-
#include "libiberty.h"
/* Virtually every UN*X system now in common use (except for pre-4.3-tahoe
@@ -50,6 +46,8 @@ extern char *getwd ();
the few exceptions to the general rule here. */
#if !defined(HAVE_GETCWD) && defined(HAVE_GETWD)
+/* Prototype in case the system headers doesn't provide it. */
+extern char *getwd ();
#define getcwd(buf,len) getwd(buf)
#endif
@@ -67,7 +65,7 @@ extern char *getwd ();
yield 0 and set errno. */
char *
-getpwd ()
+getpwd (void)
{
static char *pwd;
static int failure_errno;
@@ -86,7 +84,7 @@ getpwd ()
&& dotstat.st_dev == pwdstat.st_dev))
/* The shortcut didn't work. Try the slow, ``sure'' way. */
- for (s = GUESSPATHLEN; ! getcwd (p = xmalloc (s), s); s *= 2)
+ for (s = GUESSPATHLEN; !getcwd (p = XNEWVEC (char, s), s); s *= 2)
{
int e = errno;
free (p);
@@ -114,12 +112,12 @@ getpwd ()
#endif
char *
-getpwd ()
+getpwd (void)
{
static char *pwd = 0;
if (!pwd)
- pwd = getcwd (xmalloc (MAXPATHLEN + 1), MAXPATHLEN + 1
+ pwd = getcwd (XNEWVEC (char, MAXPATHLEN + 1), MAXPATHLEN + 1
#ifdef VMS
, 0
#endif
OpenPOWER on IntegriCloud