You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2008/06/11 15:21:39 UTC
svn commit: r666654 -
/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hysysinfo.c
Author: hindessm
Date: Wed Jun 11 06:21:39 2008
New Revision: 666654
URL: http://svn.apache.org/viewvc?rev=666654&view=rev
Log:
Don't compile functions that are not used.
Modified:
harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hysysinfo.c
Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hysysinfo.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hysysinfo.c?rev=666654&r1=666653&r2=666654&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hysysinfo.c (original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hysysinfo.c Wed Jun 11 06:21:39 2008
@@ -50,13 +50,17 @@
#include "hyportpg.h"
#define CDEV_CURRENT_FUNCTION _prototypes_private
+#if !defined(FREEBSD)
+static IDATA readSymbolicLink (struct HyPortLibrary *portLibrary,
+ char *linkFilename, char **result);
+#if !defined(LINUX)
static BOOLEAN isSymbolicLink (struct HyPortLibrary *portLibrary,
char *filename);
static IDATA cwdname (struct HyPortLibrary *portLibrary, char **result);
-static IDATA readSymbolicLink (struct HyPortLibrary *portLibrary,
- char *linkFilename, char **result);
static IDATA searchSystemPath (struct HyPortLibrary *portLibrary,
char *filename, char **result);
+#endif
+#endif
#undef CDEV_CURRENT_FUNCTION
@@ -456,6 +460,48 @@
#undef CDEV_CURRENT_FUNCTION
+#if !defined(FREEBSD)
+#define CDEV_CURRENT_FUNCTION readSymbolicLink
+/**
+ * @internal Attempts to read the contents of a symbolic link. (The contents are the relative pathname of
+ * the thing linked to). A buffer large enough to hold the result (and the terminating NUL) is
+ * allocated with portLibrary->mem_allocate_memory. The caller should free this buffer with
+ * portLibrary->mem_free_memory when it is no longer needed.
+ * On success, returns 0. On error, returns -1.
+ */
+static IDATA
+readSymbolicLink (struct HyPortLibrary *portLibrary, char *linkFilename,
+ char **result)
+{
+ /* TODO: remove this ifdef and find out what other builds break (if any) */
+#if defined(LINUX)
+ char fixedBuffer[PATH_MAX + 1];
+ int size = readlink (linkFilename, fixedBuffer, sizeof (fixedBuffer) - 1);
+#if defined(DEBUG)
+ portLibrary->tty_printf (portLibrary, "readSymbolicLink: \"%s\"\n%i\n",
+ linkFilename, size);
+#endif
+ if (size <= 0)
+ {
+ return -1;
+ }
+ fixedBuffer[size++] = '\0';
+ *result = (portLibrary->mem_allocate_memory) (portLibrary, size);
+ if (!*result)
+ {
+ return -1;
+ }
+ strcpy (*result, fixedBuffer);
+ return 0;
+#else
+ return -1;
+#endif
+
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#if !defined(LINUX)
#define CDEV_CURRENT_FUNCTION cwdname
/**
* @internal Returns the current working directory.
@@ -527,46 +573,6 @@
#undef CDEV_CURRENT_FUNCTION
-#define CDEV_CURRENT_FUNCTION readSymbolicLink
-/**
- * @internal Attempts to read the contents of a symbolic link. (The contents are the relative pathname of
- * the thing linked to). A buffer large enough to hold the result (and the terminating NUL) is
- * allocated with portLibrary->mem_allocate_memory. The caller should free this buffer with
- * portLibrary->mem_free_memory when it is no longer needed.
- * On success, returns 0. On error, returns -1.
- */
-static IDATA
-readSymbolicLink (struct HyPortLibrary *portLibrary, char *linkFilename,
- char **result)
-{
- /* TODO: remove this ifdef and find out what other builds break (if any) */
-#if defined(LINUX)
- char fixedBuffer[PATH_MAX + 1];
- int size = readlink (linkFilename, fixedBuffer, sizeof (fixedBuffer) - 1);
-#if defined(DEBUG)
- portLibrary->tty_printf (portLibrary, "readSymbolicLink: \"%s\"\n%i\n",
- linkFilename, size);
-#endif
- if (size <= 0)
- {
- return -1;
- }
- fixedBuffer[size++] = '\0';
- *result = (portLibrary->mem_allocate_memory) (portLibrary, size);
- if (!*result)
- {
- return -1;
- }
- strcpy (*result, fixedBuffer);
- return 0;
-#else
- return -1;
-#endif
-
-}
-
-#undef CDEV_CURRENT_FUNCTION
-
#define CDEV_CURRENT_FUNCTION searchSystemPath
/**
* @internal Searches through the system PATH for the named file. If found, it returns the path entry
@@ -655,6 +661,8 @@
}
#undef CDEV_CURRENT_FUNCTION
+#endif
+#endif
#define CDEV_CURRENT_FUNCTION hysysinfo_get_number_CPUs
/**