You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/11/09 22:20:40 UTC

svn commit: r834243 - in /commons/sandbox/runtime/trunk/src/main/native: configure include/acr_string.h os/darwin/env.c os/hpux/env.c os/linux/env.c os/win32/dir.c os/win32/env.c

Author: mturk
Date: Mon Nov  9 21:20:39 2009
New Revision: 834243

URL: http://svn.apache.org/viewvc?rev=834243&view=rev
Log:
Use strdup replacement where possible

Modified:
    commons/sandbox/runtime/trunk/src/main/native/configure
    commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h
    commons/sandbox/runtime/trunk/src/main/native/os/darwin/env.c
    commons/sandbox/runtime/trunk/src/main/native/os/hpux/env.c
    commons/sandbox/runtime/trunk/src/main/native/os/linux/env.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/env.c

Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=834243&r1=834242&r2=834243&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Mon Nov  9 21:20:39 2009
@@ -968,7 +968,7 @@
 fi
 
 if [ ".$cc" = .gcc ]; then
-    if [ ${cc_ver_major}${cc_ver_minor}0 -gt 410 ]; then
+    if [ ${cc_ver_major}${cc_ver_minor}0 -gt 400 ]; then
         varadds cppopts -DUSE_ATOMICS_BUILTINS
     fi
 fi

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h?rev=834243&r1=834242&r2=834243&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h Mon Nov  9 21:20:39 2009
@@ -158,7 +158,14 @@
  * @return Pointer to duplicated string.
  */
 ACR_DECLARE(char *) ACR_StrdupA(JNIEnv *env, const char *file, int line,
-                               const char *s);
+                               const char *str);
+
+/**
+ * Apache's "replacement" for the strdup() function.
+ * @param str String to duplicate.
+ * @return Pointer to duplicated string.
+ */
+ACR_DECLARE(char *) ACR_strdup(const char *str);
 
 /**
  * Apache's "replacement" for the wcsdup() function that throws
@@ -170,7 +177,14 @@
  * @return Pointer to duplicated string.
  */
 ACR_DECLARE(wchar_t *) ACR_StrdupW(JNIEnv *env, const char *file, int line,
-                                   const wchar_t *s);
+                                   const wchar_t *str);
+
+/**
+ * Apache's "replacement" for the wcsdup() function.
+ * @param str String to duplicate.
+ * @return Pointer to duplicated string.
+ */
+ACR_DECLARE(wchar_t *) ACR_wcsdup(const wchar_t *str);
 
 /**
  * Concatenate string.

Modified: commons/sandbox/runtime/trunk/src/main/native/os/darwin/env.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/env.c?rev=834243&r1=834242&r2=834243&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/darwin/env.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/env.c Mon Nov  9 21:20:39 2009
@@ -25,7 +25,7 @@
 
 ACR_DECLARE(char *) ACR_EnvGet(const char *var)
 {
-    return ACR_StrdupA(INVALID_HANDLE_VALUE, THROW_NMARK, getenv(var));
+    return ACR_strdup(getenv(var));
 }
 
 ACR_DECLARE(int) ACR_EnvHas(const char *var)

Modified: commons/sandbox/runtime/trunk/src/main/native/os/hpux/env.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/hpux/env.c?rev=834243&r1=834242&r2=834243&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/hpux/env.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/hpux/env.c Mon Nov  9 21:20:39 2009
@@ -24,7 +24,7 @@
 
 ACR_DECLARE(char *) ACR_EnvGet(const char *var)
 {
-    return ACR_StrdupA(INVALID_HANDLE_VALUE, THROW_NMARK, getenv(var));
+    return ACR_strdup(getenv(var));
 }
 
 ACR_DECLARE(int) ACR_EnvHas(const char *var)

Modified: commons/sandbox/runtime/trunk/src/main/native/os/linux/env.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/linux/env.c?rev=834243&r1=834242&r2=834243&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/linux/env.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/linux/env.c Mon Nov  9 21:20:39 2009
@@ -25,7 +25,7 @@
 
 ACR_DECLARE(char *) ACR_EnvGet(const char *var)
 {
-    return ACR_StrdupA(INVALID_HANDLE_VALUE, THROW_NMARK, getenv(var));
+    return ACR_strdup(getenv(var));
 }
 
 ACR_DECLARE(int) ACR_EnvHas(const char *var)

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c?rev=834243&r1=834242&r2=834243&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c Mon Nov  9 21:20:39 2009
@@ -186,7 +186,7 @@
         return 0;
     if (rc == ERROR_PATH_NOT_FOUND) {  /* Missing an intermediate dir */
         wchar_t *pos;
-        wchar_t *dir = ACR_StrdupW(INVALID_HANDLE_VALUE, THROW_NMARK, name);
+        wchar_t *dir = ACR_wcsdup(name);
         if (!dir)
             return ACR_ENOMEM;
         if ((pos = wcsrchr(dir, L'\\'))) {

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/env.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/env.c?rev=834243&r1=834242&r2=834243&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/env.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/env.c Mon Nov  9 21:20:39 2009
@@ -150,7 +150,7 @@
             return buf;
         }
     }
-    return ACR_StrdupA(INVALID_HANDLE_VALUE, THROW_NMARK, env);
+    return ACR_strdup(env);
 }
 
 ACR_DECLARE(int) ACR_EnvHas(const char *var)
@@ -252,7 +252,7 @@
             return buf;
         }
     }
-    return ACR_StrdupW(INVALID_HANDLE_VALUE, THROW_NMARK, env);
+    return ACR_wcsdup(env);
 }
 
 int acr_EnvSetW(const wchar_t *var, const wchar_t *val)