commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r898690 - in /commons/sandbox/runtime/trunk/src/main/native: include/ os/darwin/ os/hpux/ os/linux/ os/solaris/ os/unix/ os/win32/ shared/
Date Wed, 13 Jan 2010 09:37:21 GMT
Author: mturk
Date: Wed Jan 13 09:37:19 2010
New Revision: 898690

URL: http://svn.apache.org/viewvc?rev=898690&view=rev
Log:
Use macros instead alloc functions directly

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/acr_memory.h
    commons/sandbox/runtime/trunk/src/main/native/os/darwin/group.c
    commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c
    commons/sandbox/runtime/trunk/src/main/native/os/darwin/user.c
    commons/sandbox/runtime/trunk/src/main/native/os/hpux/group.c
    commons/sandbox/runtime/trunk/src/main/native/os/hpux/shm.c
    commons/sandbox/runtime/trunk/src/main/native/os/hpux/user.c
    commons/sandbox/runtime/trunk/src/main/native/os/linux/group.c
    commons/sandbox/runtime/trunk/src/main/native/os/linux/user.c
    commons/sandbox/runtime/trunk/src/main/native/os/solaris/group.c
    commons/sandbox/runtime/trunk/src/main/native/os/solaris/user.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysrw.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/mmap.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/mutex.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/pipe.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/sema.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/temps.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/dtc.cpp
    commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysrw.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/pipe.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/subproc.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/user.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/variant.cpp
    commons/sandbox/runtime/trunk/src/main/native/os/win32/wmi.cpp
    commons/sandbox/runtime/trunk/src/main/native/os/win32/wusec.c
    commons/sandbox/runtime/trunk/src/main/native/shared/callback.c
    commons/sandbox/runtime/trunk/src/main/native/shared/db.c
    commons/sandbox/runtime/trunk/src/main/native/shared/error.c
    commons/sandbox/runtime/trunk/src/main/native/shared/ini.c
    commons/sandbox/runtime/trunk/src/main/native/shared/memory.c
    commons/sandbox/runtime/trunk/src/main/native/shared/string.c
    commons/sandbox/runtime/trunk/src/main/native/shared/tables.c

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_memory.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_memory.h?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_memory.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_memory.h Wed Jan 13 09:37:19
2010
@@ -31,8 +31,20 @@
  *
  */
 
-#define ACR_MALLOC(T, N)  ((T *)ACR_Malloc(_E, THROW_FMARK, sizeof(T) * (N)))
-#define ACR_CALLOC(T, N)  ((T *)ACR_Calloc(_E, THROW_FMARK, sizeof(T) * (N)))
+/** Some handy macros over alloc/free functions
+ */
+#define ACR_TMALLOC(T, N)       ((T *)ACR_Malloc(_E, THROW_FMARK, sizeof(T) * (N)))
+#define ACR_TCALLOC(T, N)       ((T *)ACR_Calloc(_E, THROW_FMARK, sizeof(T) * (N)))
+#define ACR_EMALLOC(T, S)       ((T *)ACR_Malloc(_E, THROW_FMARK, (S)))
+#define ACR_ECALLOC(T, S)       ((T *)ACR_Calloc(_E, THROW_FMARK, (S)))
+#define ACR_ARRAY_ALLOC(T, N)   ((T *)ACR_Aalloc(_E, THROW_FMARK, (N)))
+
+/**
+ * This macros supress exceptions on invalid
+ * pointers if it's not needed
+ */
+#define ACR_FREE(M)             ACR_Free(INVALID_HANDLE_VALUE, THROW_NMARK, (M))
+#define ACR_ARRAY_FREE(A)       ACR_Afree(INVALID_HANDLE_VALUE, THROW_NMARK, (A))
 
 /** Opaque Small Block Heap structure */
 typedef struct acr_sbh_t acr_sbh_t;

Modified: commons/sandbox/runtime/trunk/src/main/native/os/darwin/group.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/group.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/darwin/group.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/group.c Wed Jan 13 09:37:19 2010
@@ -60,7 +60,7 @@
         /* No groups defined */
         return NULL;
     }
-    gnames = (char **)ACR_Calloc(_E, THROW_FMARK, n * sizeof(char *));
+    gnames = ACR_TCALLOC(char *, n);
     if (!gnames) {
         return NULL;
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c Wed Jan 13 09:37:19 2010
@@ -104,7 +104,7 @@
     int anon = 0;
     acr_pmutex_t *m;
 
-    m = ACR_Calloc(_E, THROW_FMARK, sizeof(acr_pmutex_t));
+    m = ACR_TCALLOC(acr_pmutex_t, 1);
     if (!m)
         return -1;
     if (!fname) {
@@ -152,7 +152,7 @@
         ACR_THROW_IO_IF_ERR(ACR_EINVAL);
         return -1;
     }
-    m = ACR_Calloc(_E, THROW_FMARK, sizeof(acr_pmutex_t));
+    m = ACR_TCALLOC(acr_pmutex_t, 1);
     if (!m)
         return -1;
     m->filedes = open(fname, O_WRONLY);
@@ -407,7 +407,7 @@
         close(fd);
         flags |= IPC_EXCL;
     }
-    m = ACR_CALLOC(acr_pmutex_t, 1);
+    m = ACR_TCALLOC(acr_pmutex_t, 1);
     if (!m)
         return -1;
     if (fname) {
@@ -480,7 +480,7 @@
         return -1;
     }
     close(file);
-    m = ACR_CALLOC(acr_pmutex_t, 1);
+    m = ACR_TCALLOC(acr_pmutex_t, 1);
     if (!m)
         return -1;
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/darwin/user.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/user.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/darwin/user.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/user.c Wed Jan 13 09:37:19 2010
@@ -60,7 +60,7 @@
         /* No groups defined */
         return NULL;
     }
-    unames = (char **)ACR_Calloc(_E, THROW_FMARK, n * sizeof(char *));
+    unames = ACR_TCALLOC(char *, n);
     if (!unames) {
         return NULL;
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/hpux/group.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/hpux/group.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/hpux/group.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/hpux/group.c Wed Jan 13 09:37:19 2010
@@ -56,7 +56,7 @@
         /* No groups defined */
         return NULL;
     }
-    gnames = (char **)ACR_Calloc(_E, THROW_FMARK, n * sizeof(char *));
+    gnames = ACR_TCALLOC(char *, n);
     if (!gnames) {
         return NULL;
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/hpux/shm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/hpux/shm.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/hpux/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/hpux/shm.c Wed Jan 13 09:37:19 2010
@@ -215,7 +215,7 @@
         ACR_THROW_EX_IF_ERR(ACR_EX_EINVAL, ACR_EINVAL);
         return -1;
     }
-    shm = ACR_CALLOC(acr_shm_t, 1);
+    shm = ACR_TCALLOC(acr_shm_t, 1);
     if (!shm)
         return -1;
     /* Check if they want anonymous or name-based shared memory */
@@ -351,7 +351,7 @@
         ACR_THROW_IO_IF_ERR(ACR_EINVAL);
         return -1;
     }
-    shm = ACR_CALLOC(acr_shm_t, 1);
+    shm = ACR_TCALLOC(acr_shm_t, 1);
     if (!shm)
         return -1;
     shm->filename = ACR_StrdupA(_E, THROW_FMARK, filename);

Modified: commons/sandbox/runtime/trunk/src/main/native/os/hpux/user.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/hpux/user.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/hpux/user.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/hpux/user.c Wed Jan 13 09:37:19 2010
@@ -56,7 +56,7 @@
         /* No groups defined */
         return NULL;
     }
-    unames = (char **)ACR_Calloc(_E, THROW_FMARK, n * sizeof(char *));
+    unames = ACR_TCALLOC(char *, n);
     if (!unames) {
         return NULL;
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/linux/group.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/linux/group.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/linux/group.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/linux/group.c Wed Jan 13 09:37:19 2010
@@ -58,7 +58,7 @@
         /* No groups defined */
         return NULL;
     }
-    gnames = (char **)ACR_Calloc(_E, THROW_FMARK, n * sizeof(char *));
+    gnames = ACR_TCALLOC(char *, n);
     if (!gnames) {
         return NULL;
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/linux/user.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/linux/user.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/linux/user.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/linux/user.c Wed Jan 13 09:37:19 2010
@@ -58,7 +58,7 @@
         /* No groups defined */
         return NULL;
     }
-    unames = (char **)ACR_Calloc(_E, THROW_FMARK, n * sizeof(char *));
+    unames = ACR_TCALLOC(char *, n);
     if (!unames) {
         return NULL;
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/solaris/group.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/solaris/group.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/solaris/group.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/solaris/group.c Wed Jan 13 09:37:19 2010
@@ -62,7 +62,7 @@
         /* No groups defined */
         return NULL;
     }
-    gnames = (char **)ACR_Calloc(_E, THROW_FMARK, n * sizeof(char *));
+    gnames = ACR_TCALLOC(char *, n);
     if (!gnames) {
         return NULL;
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/solaris/user.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/solaris/user.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/solaris/user.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/solaris/user.c Wed Jan 13 09:37:19 2010
@@ -62,7 +62,7 @@
         /* No groups defined */
         return NULL;
     }
-    unames = (char **)ACR_Calloc(_E, THROW_FMARK, n * sizeof(char *));
+    unames = ACR_TCALLOC(char *, n);
     if (!unames) {
         return NULL;
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c Wed Jan 13 09:37:19 2010
@@ -196,7 +196,7 @@
         if ((rc = acr_nonblock(fd, 1)))
             goto finally;
     }
-    fp = ACR_CALLOC(acr_file_t, 1);
+    fp = ACR_TCALLOC(acr_file_t, 1);
     if (!fp) {
         rc = ACR_ENOMEM;
         goto finally;
@@ -316,7 +316,7 @@
             return NULL;
         break;
     }
-    fp = ACR_CALLOC(acr_file_t, 1);
+    fp = ACR_TCALLOC(acr_file_t, 1);
     if (!fp) {
         rc = ACR_ENOMEM;
         goto finally;
@@ -689,7 +689,7 @@
         ACR_THROW_IO_ERRNO();
         return NULL;
     }
-    d = ACR_CALLOC(acr_file_t, 1);
+    d = ACR_TCALLOC(acr_file_t, 1);
     if (!d) {
         close(df);
         ACR_THROW_IO_IF_ERR(ACR_ENOMEM);

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysrw.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysrw.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysrw.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysrw.c Wed Jan 13 09:37:19 2010
@@ -174,7 +174,7 @@
                 bb = bc + po;
         }
         else
-            bb = ACR_Malloc(_E, THROW_FMARK, cs);
+            bb = ACR_EMALLOC(jbyte, cs);
     }
     else
         bb = onstack;
@@ -460,7 +460,7 @@
                 bb = bc + po;
         }
         else
-            bb = ACR_Malloc(_E, THROW_FMARK, cs);
+            bb = ACR_EMALLOC(jbyte, cs);
     }
     else
         bb = onstack;
@@ -928,8 +928,8 @@
     if ((*_E)->EnsureLocalCapacity(_E, (jint)(cs * 2)))
         return -1;
     if (cs > ACR_IOVEC_ON_STACK) {
-        iov = ACR_MALLOC(struct iovec, cs);
-        boa = ACR_MALLOC(jbyteArray, cs);
+        iov = ACR_TMALLOC(struct iovec, cs);
+        boa = ACR_TMALLOC(jbyteArray, cs);
     }
     else {
         iov = onstack;
@@ -1019,7 +1019,7 @@
         return -1;
     }
     if (cs > ACR_IOVEC_ON_STACK)
-        iov = ACR_MALLOC(struct iovec, cs);
+        iov = ACR_TMALLOC(struct iovec, cs);
     else
         iov = onstack;
     if (!iov)

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/mmap.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/mmap.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/mmap.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/mmap.c Wed Jan 13 09:37:19 2010
@@ -183,7 +183,7 @@
         ACR_THROW_EX_IF_ERR(ACR_EX_EINVAL, ACR_EBADF);
         return -1;
     }
-    map = ACR_CALLOC(acr_mmap_t, 1);
+    map = ACR_TCALLOC(acr_mmap_t, 1);
     if (!map)
         return -1;
 
@@ -214,7 +214,7 @@
         ACR_THROW_IO_ERRNO();
         return -1;
     }
-    map = ACR_CALLOC(acr_mmap_t, 1);
+    map = ACR_TCALLOC(acr_mmap_t, 1);
     if (!map) {
         return -1;
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/mutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/mutex.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/mutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/mutex.c Wed Jan 13 09:37:19 2010
@@ -112,7 +112,7 @@
     acr_pmutex_t *m;
     char *p;
 
-    m = ACR_CALLOC(acr_pmutex_t, 1);
+    m = ACR_TCALLOC(acr_pmutex_t, 1);
     if (!m)
         return -1;
     if (!name)
@@ -175,7 +175,7 @@
         rc = ACR_EINVAL;
         goto finally;
     }
-    m = ACR_CALLOC(acr_pmutex_t, 1);
+    m = ACR_TCALLOC(acr_pmutex_t, 1);
     if (!m)
         return -1;
     if (*name != '/')
@@ -402,7 +402,7 @@
         close(fd);
         flags |= IPC_EXCL;
     }
-    m = ACR_CALLOC(acr_pmutex_t, 1);
+    m = ACR_TCALLOC(acr_pmutex_t, 1);
     if (!m)
         return -1;
     if (fname) {
@@ -475,7 +475,7 @@
         return -1;
     }
     close(file);
-    m = ACR_CALLOC(acr_pmutex_t, 1);
+    m = ACR_TCALLOC(acr_pmutex_t, 1);
     if (!m)
         return -1;
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/pipe.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/pipe.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/pipe.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/pipe.c Wed Jan 13 09:37:19 2010
@@ -246,7 +246,7 @@
     /* We have two handles created.
      * Create wrapper objects and events
      */
-    *rd = ACR_CALLOC(acr_file_t, 1);
+    *rd = ACR_TCALLOC(acr_file_t, 1);
     if (!*rd) {
         rc = ACR_ENOMEM;
         goto finally;
@@ -265,7 +265,7 @@
         (*rd)->timeout  = -1;
     }
 
-    *wr = ACR_CALLOC(acr_file_t, 1);
+    *wr = ACR_TCALLOC(acr_file_t, 1);
     if (!*wr) {
         rc = ACR_ENOMEM;
         goto finally;

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/sema.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/sema.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/sema.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/sema.c Wed Jan 13 09:37:19 2010
@@ -89,7 +89,7 @@
     acr_semaphore_t *s;
     char *p;
 
-    s = ACR_CALLOC(acr_semaphore_t, 1);
+    s = ACR_TCALLOC(acr_semaphore_t, 1);
     if (!s)
         return -1;
     if (!name)
@@ -152,7 +152,7 @@
         rc = ACR_EINVAL;
         goto finally;
     }
-    s = ACR_CALLOC(acr_semaphore_t, 1);
+    s = ACR_TCALLOC(acr_semaphore_t, 1);
     if (!s)
         return -1;
     if (*name != '/')

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c Wed Jan 13 09:37:19 2010
@@ -215,7 +215,7 @@
         ACR_THROW_EX_IF_ERR(ACR_EX_EINVAL, ACR_EINVAL);
         return -1;
     }
-    shm = ACR_CALLOC(acr_shm_t, 1);
+    shm = ACR_TCALLOC(acr_shm_t, 1);
     if (!shm)
         return -1;
     /* Check if they want anonymous or name-based shared memory */
@@ -337,7 +337,7 @@
         ACR_THROW_IO_IF_ERR(ACR_EINVAL);
         return -1;
     }
-    shm = ACR_CALLOC(acr_shm_t, 1);
+    shm = ACR_TCALLOC(acr_shm_t, 1);
     if (!shm)
         return -1;
     shm->filename = ACR_StrdupA(_E, THROW_FMARK, filename);

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/temps.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/temps.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/temps.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/temps.c Wed Jan 13 09:37:19 2010
@@ -107,7 +107,7 @@
     if (rc) {
         goto finally;
     }
-    fp = ACR_CALLOC(acr_file_t, 1);
+    fp = ACR_TCALLOC(acr_file_t, 1);
     if (!fp) {
         goto cleanup;
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/dtc.cpp
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/dtc.cpp?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/dtc.cpp (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/dtc.cpp Wed Jan 13 09:37:19 2010
@@ -119,7 +119,7 @@
     dtc_transaction_t *ts = NULL;
     HRESULT hres;
 
-    if (!(ts = ACR_CALLOC(dtc_transaction_t, 1))) {
+    if (!(ts = ACR_TCALLOC(dtc_transaction_t, 1))) {
         return NULL;
     }
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c Wed Jan 13 09:37:19 2010
@@ -208,8 +208,8 @@
             DWORD dlen;
             wchar_t fpath[ACR_HBUFF_SIZ];
 
-            mpb = ACR_Calloc(_E, THROW_FMARK,
-                             MAXIMUM_REPARSE_DATA_BUFFER_SIZE);
+            mpb = ACR_ECALLOC(char,
+                              MAXIMUM_REPARSE_DATA_BUFFER_SIZE);
             if (!mpb) {
                 goto bailout;
             }
@@ -321,7 +321,7 @@
 
     UNREFERENCED_O;
     WITH_WPATH(lnkname) {
-        void *buf = ACR_Calloc(_E, THROW_FMARK, MAXIMUM_REPARSE_DATA_BUFFER_SIZE);
+        void *buf = ACR_ECALLOC(void, MAXIMUM_REPARSE_DATA_BUFFER_SIZE);
         if (buf) {
             HANDLE sh = CreateFileW(J2W(lnkname),
                                     GENERIC_READ,

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c Wed Jan 13 09:37:19 2010
@@ -215,7 +215,7 @@
     if (IS_INVALID_HANDLE(fh)) {
         return ACR_GET_OS_ERROR();
     }
-    fp = ACR_CALLOC(acr_file_t, 1);
+    fp = ACR_TCALLOC(acr_file_t, 1);
     if (!fp) {
         rc = ACR_ENOMEM;
         goto finally;
@@ -366,7 +366,7 @@
          */
         fd = INVALID_HANDLE_VALUE;
     }
-    fp = ACR_CALLOC(acr_file_t, 1);
+    fp = ACR_TCALLOC(acr_file_t, 1);
     if (!fp) {
         rc = ACR_ENOMEM;
         goto finally;
@@ -724,7 +724,7 @@
         ACR_THROW_IO_ERRNO();
         return NULL;
     }
-    d = ACR_CALLOC(acr_file_t, 1);
+    d = ACR_TCALLOC(acr_file_t, 1);
     if (!d) {
         CloseHandle(dh);
         ACR_THROW_IO_IF_ERR(ACR_ENOMEM);

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysrw.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysrw.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysrw.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysrw.c Wed Jan 13 09:37:19 2010
@@ -316,7 +316,7 @@
                 bb = bc + po;
         }
         else
-            bb = ACR_Malloc(_E, THROW_FMARK, cs);
+            bb = ACR_EMALLOC(jbyte, cs);
     }
     else
         bb = onstack;
@@ -860,7 +860,7 @@
                 bb = bc + po;
         }
         else
-            bb = ACR_Malloc(_E, THROW_FMARK, cs);
+            bb = ACR_EMALLOC(jbyte, cs);
     }
     else
         bb = onstack;

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c Wed Jan 13 09:37:19 2010
@@ -176,7 +176,7 @@
     WCHAR  name[MAX_PATH];
 
     len = GetLengthSid(id);
-    if (!(sid = ACR_Malloc(_E, THROW_FMARK, len)))
+    if (!(sid = ACR_EMALLOC(SID, len)))
         return NULL;
     if (!CopySid(len, sid, id)) {
         ACR_THROW_OS_ERRNO();

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c Wed Jan 13 09:37:19 2010
@@ -174,7 +174,7 @@
         ACR_THROW_EX_IF_ERR(ACR_EX_EINVAL, ACR_EBADF);
         return -1;
     }
-    map = ACR_CALLOC(acr_mmap_t, 1);
+    map = ACR_TCALLOC(acr_mmap_t, 1);
     if (!map)
         return -1;
 
@@ -218,7 +218,7 @@
     DWORD prot = 0;
     acr_mmap_t *map;
 
-    map = ACR_CALLOC(acr_mmap_t, 1);
+    map = ACR_TCALLOC(acr_mmap_t, 1);
     if (!map)
         return -1;
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c Wed Jan 13 09:37:19 2010
@@ -219,7 +219,7 @@
     if (b && srclen < (ACR_MBUFF_LEN - 8))
         rv = b;
     else {
-        rv = ACR_MALLOC(wchar_t, srclen + 9);
+        rv = ACR_TMALLOC(wchar_t, srclen + 9);
         if (!rv) {
             /* Exception has already been throw from ACR_Malloc
              */

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/pipe.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/pipe.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/pipe.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/pipe.c Wed Jan 13 09:37:19 2010
@@ -300,7 +300,7 @@
     /* We have two handles created.
      * Create wrapper objects and events
      */
-    *rd = ACR_CALLOC(acr_file_t, 1);
+    *rd = ACR_TCALLOC(acr_file_t, 1);
     if (!*rd) {
         rc = ACR_ENOMEM;
         goto finally;
@@ -320,7 +320,7 @@
         (*rd)->timeout  = -1;
     }
 
-    *wr = ACR_CALLOC(acr_file_t, 1);
+    *wr = ACR_TCALLOC(acr_file_t, 1);
     if (!*wr) {
         rc = ACR_ENOMEM;
         goto finally;

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c Wed Jan 13 09:37:19 2010
@@ -155,7 +155,7 @@
     sizehi = 0;
 #endif
 
-    shm = ACR_CALLOC(acr_shm_t, 1);
+    shm = ACR_TCALLOC(acr_shm_t, 1);
     if (!shm)
         return -1;
     /* Check if they want anonymous or name-based shared memory */
@@ -279,7 +279,7 @@
         rc = ACR_EINVAL;
         goto finally;
     }
-    shm = ACR_CALLOC(acr_shm_t, 1);
+    shm = ACR_TCALLOC(acr_shm_t, 1);
     if (!shm)
         return -1;
     if (_wcsnicmp(filename, L"shared::", 8) == 0) {

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/subproc.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/subproc.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/subproc.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/subproc.c Wed Jan 13 09:37:19 2010
@@ -23,6 +23,7 @@
 #include "acr_port.h"
 #include "acr_string.h"
 #include "acr_tlsd.h"
+#include "acr_args.h"
 #include "acr_vm.h"
 
 #if !defined(ACR_DECLARE_EXPORT)
@@ -33,7 +34,9 @@
 /* Subproc is a way how ACR launches external programs without flashing
  * console or with elevated priviledges on Windows Vista and later.
  * It also allows to create GUI applications from services running in
- * Session zero.
+ * Session zero. Since handles cannot be inherited between sessions
+ * we launch rundll32.exe in a separate process and reopen the handles
+ * instead duplicating them.
  *
  * Our SubprocMain is invoked by Rundll32. The first argument is
  * the hex encoded shared memory HANDLE which we duplicate and use in
@@ -64,7 +67,76 @@
                                                   LPWSTR lpszCmdLine,
                                                   int nCmdShow)
 {
-    OutputDebugStringW(L"SubprocMainW init");
-    OutputDebugStringW(GetCommandLineW());
-    OutputDebugStringW(L"SubprocMainW done");
+    int       i;
+    int       rc = 0;
+    int       argc;
+    wchar_t **args = NULL;
+    wchar_t **argv = NULL;
+
+
+
+    if ((rc = ACR_Initialize(NULL))) {
+        ACR_DEBUG(("Failed to initialize the ACR error=%d\n", rc));
+        goto cleanup;
+    }
+    if ((rc = ACR_PlatformInitialize(INVALID_HANDLE_VALUE, 0))) {
+        ACR_DEBUG(("Failed to initialize the ACR platform error=%d\n", rc));
+        goto cleanup;
+    }
+
+    argc = ACR_StringToArgvW(GetCommandLineW(), 0, NULL, &args);
+    if (argc < 0) {
+        rc = ACR_GET_OS_ERROR();
+        goto cleanup;
+    }
+    argv = args;
+    if (argc < 3) {
+        /* First two arguments are Rundll32.exe and our libacr.dll,Export
+         * Our private arguments always start with double slash
+         * and end on first argument that doesn't start with it or
+         * with explicit "-" or "//" marker.
+         */
+        rc = ACR_EINVAL;
+        goto cleanup;
+    }
+    for (i = 2; i < argc; i++) {
+        if ((argv[i][0] == L'/' && argv[i][1] == L'/') ||
+            (argv[i][0] == L'-' && argv[i][1] == L'-')) {
+            wchar_t *opt;
+            wchar_t *cmd = argv[i] + 2;
+            if (!*cmd) {
+                /* Skip Explicit command delimiter
+                 * In case our child needs "//" as first argument
+                 */
+                i++;
+                break;
+            }
+            /* Parse internal command by spliting the
+             * //CMD[:OPT] to CMD and OPT or
+             * --CMD[=OPT] to CMD and OPT
+             */
+            if ((opt = wcspbrk(cmd, L":=")))
+                *(opt++) = '\0';
+            printf("internal[%d] : %S=%S\n", i, cmd, opt);
+
+        }
+        else
+            break;
+    }
+    argv += i;
+    argc -= i;
+    if (argc < 1) {
+        /* We at least need the process name
+         */
+        rc = ACR_EINVAL;
+        goto cleanup;    
+    }
+
+    for (i = 0; i < argc; i++) {
+        printf("ARG[%d] : %S.\n", i, argv[i]);
+    }
+
+cleanup:
+    ACR_ARRAY_FREE(args);
+    ExitProcess(rc);
 }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/temps.c Wed Jan 13 09:37:19 2010
@@ -301,7 +301,7 @@
         ACR_THROW_IO_ERRNO();
         return -1;
     }
-    fp = ACR_CALLOC(acr_file_t, 1);
+    fp = ACR_TCALLOC(acr_file_t, 1);
     if (!fp) {
         goto cleanup;
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/user.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/user.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/user.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/user.c Wed Jan 13 09:37:19 2010
@@ -203,7 +203,7 @@
     WCHAR name[MAX_PATH];
 
     len = GetLengthSid(id);
-    if (!(sid = ACR_Malloc(_E, THROW_FMARK, len)))
+    if (!(sid = ACR_EMALLOC(SID, len)))
         return NULL;
     if (!CopySid(len, sid, id)) {
         ACR_THROW_OS_ERRNO();

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/variant.cpp
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/variant.cpp?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/variant.cpp (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/variant.cpp Wed Jan 13 09:37:19
2010
@@ -41,7 +41,7 @@
 extern "C"
 ACR_JNI_PLATFORM_DECLARE(jlong, VARIANT, alloc0)(ACR_JNISTDARGS)
 {
-    VARIANT *v = (VARIANT *)ACR_Calloc(_E, THROW_FMARK, sizeof(VARIANT));
+    VARIANT *v = ACR_TCALLOC(VARIANT, 1);
 
     UNREFERENCED_O;
     if (!v)
@@ -54,7 +54,7 @@
 ACR_JNI_PLATFORM_DECLARE(jlong, VARIANT, alloc1)(ACR_JNISTDARGS, jstring str)
 {
     jlong r    = 0L;
-    VARIANT *v = (VARIANT *)ACR_Calloc(_E, THROW_FMARK, sizeof(VARIANT));
+    VARIANT *v = ACR_TCALLOC(VARIANT, 1);
 
     UNREFERENCED_O;
     if (!v)

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/wmi.cpp
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/wmi.cpp?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/wmi.cpp (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/wmi.cpp Wed Jan 13 09:37:19 2010
@@ -89,7 +89,7 @@
         cosec_inited = 1;
     }
 
-    if (!(wd = ACR_CALLOC(wmi_data_t, 1))) {
+    if (!(wd = ACR_TCALLOC(wmi_data_t, 1))) {
         return NULL;
     }
     hres = CoCreateInstance(

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/wusec.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/wusec.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/wusec.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/wusec.c Wed Jan 13 09:37:19 2010
@@ -116,12 +116,12 @@
         }
         return NULL;
     }
-    if (!(rv = ACR_Malloc(_E, THROW_FMARK, sz))) {
+    if (!(rv = ACR_EMALLOC(void, sz))) {
         return NULL;
     }
     if (!GetTokenInformation(h, ic, rv, sz, &sz)) {
         rc = ACR_GET_OS_ERROR();
-        if(_E) {
+        if(IS_VALID_HANDLE(_E)) {
             ACR_ThrowException(_E, THROW_NMARK, ACR_EX_OSERR, rc);
         }
         x_free(rv);

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/callback.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/callback.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/callback.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/callback.c Wed Jan 13 09:37:19 2010
@@ -64,8 +64,8 @@
                                                  acr_callback_handler_fn_t *handler)
 {
 
-    acr_callback_t *cb = ACR_Calloc(_E, THROW_NMARK,
-                                    sizeof(acr_callback_t) + size);
+    acr_callback_t *cb = ACR_ECALLOC(acr_callback_t,
+                                     sizeof(acr_callback_t) + size);
     if (cb == NULL)
         return NULL;
     cb->type    = type;
@@ -84,8 +84,8 @@
                                                  acr_callback_handler_fn_t *handler)
 {
 
-    acr_callback_t *cb = ACR_Calloc(_E, THROW_NMARK,
-                                    sizeof(acr_callback_t) + size);
+    acr_callback_t *cb = ACR_ECALLOC(acr_callback_t,
+                                     sizeof(acr_callback_t) + size);
     if (cb == NULL)
         return NULL;
     if (IS_VALID_HANDLE(_E) && IS_VALID_HANDLE(_O)) {
@@ -108,7 +108,7 @@
 cleanup:
     if (IS_VALID_HANDLE(_E) && cb->thiz)
         (*_E)->DeleteWeakGlobalRef(_E, cb->thiz);
-    ACR_Free(INVALID_MEMORY_VALUE, THROW_NMARK, cb);
+    ACR_FREE(cb);
     return NULL;
 }
 
@@ -123,7 +123,7 @@
         if (cb->thiz)
             (*_E)->DeleteWeakGlobalRef(_E, cb->thiz);
     }
-    ACR_Free(_E, THROW_NMARK, cb);
+    ACR_FREE(cb);
     return 0;
 }
 

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/db.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/db.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/db.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/db.c Wed Jan 13 09:37:19 2010
@@ -95,7 +95,7 @@
             ACR_SET_OS_ERROR(ACR_EISNULL);
             return NULL;
         }
-        mem = ACR_Calloc(_E, THROW_NMARK, siz);
+        mem = ACR_ECALLOC(void, siz);
         if (mem) {
             /* Create the DirectBuffer class with default cleanup.
              */

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/error.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/error.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/error.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/error.c Wed Jan 13 09:37:19 2010
@@ -709,7 +709,7 @@
 
     UNREFERENCED_O;
 
-    if (!(i = (jint *)ACR_Calloc(_E, THROW_FMARK, 128 * sizeof(jint)))) {
+    if (!(i = ACR_TCALLOC(jint, 128))) {
         /* Exception was aleady thrown */
         return;
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/ini.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/ini.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/ini.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/ini.c Wed Jan 13 09:37:19 2010
@@ -51,7 +51,7 @@
 {
     acr_ini_node_t *ini;
 
-    ini = ACR_Calloc(_E, THROW_NMARK, sizeof(acr_ini_node_t) + nlen);
+    ini = ACR_ECALLOC(acr_ini_node_t, sizeof(acr_ini_node_t) + nlen);
     if (!ini)
         return NULL;
 
@@ -178,7 +178,7 @@
             return ap;
         }
     }
-    ap = ACR_Calloc(_E, THROW_NMARK, sizeof(acr_ini_attr_t) + strlen(key));
+    ap = ACR_ECALLOC(acr_ini_attr_t, sizeof(acr_ini_attr_t) + strlen(key));
     if (!ap)
         return NULL;
     strcpy(ap->buf, key);
@@ -216,7 +216,7 @@
     if (!key) {
         return NULL;
     }
-    ap = ACR_Calloc(_E, THROW_NMARK, sizeof(acr_ini_attr_t) + strlen(key));
+    ap = ACR_ECALLOC(acr_ini_attr_t, sizeof(acr_ini_attr_t) + strlen(key));
     if (!ap)
         return NULL;
     strcpy(ap->buf, key);
@@ -293,7 +293,7 @@
 {
     acr_ini_t *ini;
 
-    ini = ACR_Calloc(_E, THROW_NMARK, sizeof(acr_ini_t));
+    ini = ACR_TCALLOC(acr_ini_t, 1);
     if (!ini)
         return NULL;
     ini->cur = &ini->root;
@@ -308,7 +308,7 @@
 ACR_DECLARE(void) ACR_IniFree(JNIEnv *_E, acr_ini_t *ini)
 {
     ini_node_free(&ini->root, 1);
-    ACR_Free(_E, THROW_NMARK, ini);
+    ACR_FREE(ini);
 }
 
 ACR_DECLARE(acr_ini_node_t *) ACR_IniNodeRoot(acr_ini_t *ini)

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/memory.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/memory.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/memory.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/memory.c Wed Jan 13 09:37:19 2010
@@ -276,6 +276,7 @@
                             void **arr)
 {
     void **ptr = arr;
+
     if (IS_INVALID_HANDLE(arr)) {
         if (_E == NULL)
             _E = ACR_GetJNIEnv();
@@ -293,6 +294,7 @@
 ACR_DECLARE(size_t) ACR_Asize(const void * const *arr)
 {
     const void * const *ptr = arr;
+
     if (arr) {
         size_t len = 0;
         while (*ptr != NULL) {

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/string.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/string.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/string.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/string.c Wed Jan 13 09:37:19 2010
@@ -602,7 +602,7 @@
     jchar *dst;
 
     out = len = (jsize)strlen(str) + 1;
-    dst = ACR_MALLOC(jchar, len);
+    dst = ACR_TMALLOC(jchar, len);
     if (!dst)
         return NULL;
     if ((rc = java_utf8_to_ucs2(str, len, dst, &out))) {
@@ -621,7 +621,7 @@
     wchar_t *dst;
 
     out = len = strlen(str) + 1;
-    dst = ACR_MALLOC(wchar_t, len);
+    dst = ACR_TMALLOC(wchar_t, len);
     if (!dst)
         return NULL;
     if ((rc = conv_utf8_to_wcs(str, len, dst, &out))) {
@@ -640,7 +640,7 @@
     char *dst;
 
     out = java_ucs2_to_utf8_len(str, len);
-    dst = ACR_MALLOC(char, out);
+    dst = ACR_TMALLOC(char, out);
     if (!dst)
         return NULL;
     if ((rc = java_ucs2_to_utf8(str, len, dst, &out))) {
@@ -670,7 +670,7 @@
     if (b && nl < ACR_MBUFF_LEN)
         rv = b;
     else {
-        rv = (char *)ACR_Malloc(_E, THROW_FMARK, nl + 1);
+        rv = ACR_TMALLOC(char, nl + 1);
         if (!rv) {
             /* Exception has already neen throw from ACR_Malloc
              */
@@ -763,7 +763,7 @@
         }
         else {
             jchar  *cc;
-            if ((cc = ACR_MALLOC(jchar, l + 1))) {
+            if ((cc = ACR_TMALLOC(jchar, l + 1))) {
                 size_t  i;
                 for (i = 0; i < l; i++) {
                     cc[i] = s[i];
@@ -792,7 +792,7 @@
         }
         else {
             jchar  *cc;
-            if ((cc = ACR_MALLOC(jchar, sl + 1))) {
+            if ((cc = ACR_TMALLOC(jchar, sl + 1))) {
                 jsize wl = sl;
                 if ((ex = conv_utf8_to_ucs2(s, sl, cc, &wl)) == ACR_SUCCESS)
                     rs = (*_E)->NewString(_E, cc, sl);
@@ -1064,7 +1064,7 @@
 
     /* Allocate the required string */
 
-    res = ACR_MALLOC(wchar_t, len + 1);
+    res = ACR_TMALLOC(wchar_t, len + 1);
     if (!res) {
         x_free(p);
         return NULL;    
@@ -1191,7 +1191,7 @@
     if (b && sl < ACR_MBUFF_LEN)
         rv = b;
     else {
-        rv = ACR_MALLOC(wchar_t, sl + 1);
+        rv = ACR_TMALLOC(wchar_t, sl + 1);
         if (!rv) {
             /* Exception has already neen throw from ACR_Malloc
              */
@@ -1261,7 +1261,7 @@
         }
         else {
             jchar  *cc;
-            if ((cc = ACR_MALLOC(jchar, l + 1))) {
+            if ((cc = ACR_TMALLOC(jchar, l + 1))) {
                 size_t  i;
                 for (i = 0; i < l; i++) {
                     /* Simply assign utf32 to utf16 */
@@ -2051,7 +2051,7 @@
         return NULL;
 
     cnt = (*_E)->GetArrayLength(_E, arr);
-    ret = (char **)ACR_MALLOC(char *, cnt + 1);
+    ret = (char **)ACR_TMALLOC(char *, cnt + 1);
     if (!ret)
         return NULL;
     for (i = 0; i < cnt; i++) {
@@ -2077,7 +2077,7 @@
         return NULL;
 
     cnt = (*_E)->GetArrayLength(_E, arr);
-    ret = (wchar_t **)ACR_MALLOC(wchar_t *, cnt + 1);
+    ret = (wchar_t **)ACR_TMALLOC(wchar_t *, cnt + 1);
     if (!ret)
         return NULL;
     for (i = 0; i < cnt; i++) {

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/tables.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/tables.c?rev=898690&r1=898689&r2=898690&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/tables.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/tables.c Wed Jan 13 09:37:19 2010
@@ -52,7 +52,7 @@
         nelts = 1;
     if (esize < 1)
         esize = 1;
-    arr->elts = (char *)ACR_Malloc(_E, file, line, nelts * esize);
+    arr->elts = ACR_EMALLOC(char, nelts * esize);
     if (!arr->elts) {
         x_free(arr);
         return NULL;
@@ -92,9 +92,9 @@
     }
     if (arr->nelts == arr->nalloc) {
         acr_size_t ns = (arr->nalloc << 1);
-        void *nd;
+        char *nd;
 
-        if (!(nd = ACR_Malloc(_E, file, line, arr->esize * ns)))
+        if (!(nd = ACR_EMALLOC(char, arr->esize * ns)))
             return NULL;
         memcpy(nd, arr->elts, arr->nalloc * arr->esize);
         x_free(arr->elts);
@@ -135,14 +135,12 @@
 ACR_DECLARE(acr_table_t *) ACR_TableMake(JNIEnv *_E, const char *file, int line,
                                          acr_size_t nelts)
 {
-    acr_table_t *tbl = (acr_table_t *)ACR_Calloc(_E, file, line,
-                                                 sizeof(acr_table_t));
+    acr_table_t *tbl = ACR_TCALLOC(acr_table_t, 1);
     if (!tbl)
         return NULL;
     if (nelts < 1)
         nelts = 1;
-    tbl->a.elts = (char *)ACR_Malloc(_E, file, line,
-                                     nelts * sizeof(table_entry_t));
+    tbl->a.elts = ACR_EMALLOC(char, nelts * sizeof(table_entry_t));
     if (!tbl->a.elts) {
         x_free(tbl);
         return NULL;



Mime
View raw message