harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regi...@apache.org
Subject svn commit: r959887 - /harmony/enhanced/java/trunk/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c
Date Fri, 02 Jul 2010 07:29:04 GMT
Author: regisxu
Date: Fri Jul  2 07:29:03 2010
New Revision: 959887

URL: http://svn.apache.org/viewvc?rev=959887&view=rev
Log:
use idiomatic array syntax rather than pointer arithmetic to make it easier to read.

Modified:
    harmony/enhanced/java/trunk/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c

Modified: harmony/enhanced/java/trunk/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c?rev=959887&r1=959886&r2=959887&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c (original)
+++ harmony/enhanced/java/trunk/classlib/modules/portlib/src/main/native/a2e/unix/atoe.c Fri
Jul  2 07:29:03 2010
@@ -2035,23 +2035,23 @@ atoe_execv (const char *path, char *cons
     int size = 0, i, rc;
 
     /* Calculate the size of argv. argv always ends with a null pointer. */
-    while (*(argv + size)) {
+    while (argv[size]) {
         size++;
     }
 
     /* Allocate space for the new array and populate */
     ebcdicArgv = (char**) malloc(sizeof(char*) * (size + 1));
     for (i = 0; i < size; i++) {
-        *(ebcdicArgv + i) = a2e_string(argv[i]);
+        ebcdicArgv[i] = a2e_string(argv[i]);
     }
 
     /* Null terminate the new array */
-    *(ebcdicArgv + size) = NULL;
+    ebcdicArgv[size] = NULL;
 
     rc = execv(ebcdicPath, ebcdicArgv);
 
     for (i = 0; i < size; ++i) {
-        free(*(ebcdicArgv + i));
+        free(ebcdicArgv[i]);
     }
     free(ebcdicArgv);
     free(ebcdicPath);
@@ -2073,23 +2073,23 @@ atoe_execvp (const char *file, char *con
     int size = 0, i, rc;
 
     /* Calculate the size of argv. argv always ends with a null pointer. */
-    while (*(argv + size)) {
+    while (argv[size]) {
         size++;
     }
 
     /* Allocate space for the new array and populate */
     ebcdicArgv = (char**) malloc(sizeof(char*) * (size + 1));
     for (i = 0; i < size; i++) {
-        *(ebcdicArgv + i) = a2e_string(argv[i]);
+        ebcdicArgv[i] = a2e_string(argv[i]);
     }
 
     /* Null terminate the new array */
-    *(ebcdicArgv + size) = NULL;
+    ebcdicArgv[size] = NULL;
 
     rc = execvp(ebcdicFile, ebcdicArgv);
 
     for (i = 0; i < size; ++i) {
-        free(*(ebcdicArgv + i));
+        free(ebcdicArgv[i]);
     }
     free(ebcdicArgv);
     free(ebcdicPath);



Mime
View raw message