Do only one call to GetVersionEx in the common case.
[pspp] / lib / progreloc.c
index 0eaad385591fb363cd0bd397b337237c55c70b16..9ae08fb708fc6d91ffd89fdff73748fdbda5dd44 100644 (file)
@@ -1,5 +1,5 @@
 /* Provide relocatable programs.
-   Copyright (C) 2003-2008 Free Software Foundation, Inc.
+   Copyright (C) 2003-2009 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software: you can redistribute it and/or modify
@@ -43,7 +43,6 @@
 # include <windows.h>
 #endif
 
-#include "canonicalize.h"
 #include "relocatable.h"
 
 #ifdef NO_XMALLOC
 # include "xalloc.h"
 #endif
 
+/* Declare canonicalize_file_name.
+   The <stdlib.h> included above may be the system's one, not the gnulib
+   one.  */
+extern char * canonicalize_file_name (const char *name);
+
 /* Pathname support.
    ISSLASH(C)           tests whether C is a directory separator character.
    IS_PATH_WITH_DIR(P)  tests whether P contains a directory specification.
@@ -196,10 +200,10 @@ find_executable (const char *argv0)
 #endif
 #if HAVE_MACH_O_DYLD_H && HAVE__NSGETEXECUTABLEPATH
   /* On MacOS X 10.2 or newer, the function
-       int _NSGetExecutablePath (char *buf, unsigned long *bufsize);
+       int _NSGetExecutablePath (char *buf, uint32_t *bufsize);
      can be used to retrieve the executable's full path.  */
   char location[4096];
-  unsigned long length = sizeof (location);
+  unsigned int length = sizeof (location);
   if (_NSGetExecutablePath (location, &length) == 0
       && location[0] == '/')
     return canonicalize_file_name (location);