hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1076997 - in /hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller: configuration.c task-controller.c
Date Fri, 04 Mar 2011 03:29:04 GMT
Author: omalley
Date: Fri Mar  4 03:29:04 2011
New Revision: 1076997

URL: http://svn.apache.org/viewvc?rev=1076997&view=rev
Log:
commit 4c0f6f027bd12c94e9fb7615a299a7f6d27faa3c
Author: Yahoo\! <ltucker@yahoo-inc.com>
Date:   Thu Sep 10 19:55:32 2009 -0700

    HADOOP:5420 additional patch to correct a problem when mapred.local.dir
    is split across multiple directories

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/configuration.c
    hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/task-controller.c

Modified: hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/configuration.c
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/c%2B%2B/task-controller/configuration.c?rev=1076997&r1=1076996&r2=1076997&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/configuration.c
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/configuration.c
Fri Mar  4 03:29:04 2011
@@ -203,35 +203,27 @@ const char * get_value(char* key) {
 }
 
 const char ** get_values(char * key) {
-  const char ** toPass = NULL;
-  const char * value = get_value(key);
   char *tempTok = NULL;
   char *tempstr = NULL;
   int size = 0;
-  int len;
+  int toPassSize = MAX_SIZE;
+  const char** toPass = (const char **) malloc(sizeof(char *) * toPassSize);
+
   //first allocate any array of 10
+  const char * value = get_value(key);
   if(value != NULL) {
-    toPass = (const char **) malloc(sizeof(char *) * MAX_SIZE);
     tempTok = strtok_r((char *)value, ",", &tempstr);
-    if (tempTok != NULL) {
-      while (1) {
-        toPass[size++] = tempTok;
-        tempTok = strtok_r(NULL, ",", &tempstr);
-        if(tempTok == NULL){
-          break;
-        }
-        if((size % MAX_SIZE) == 0) {
-          toPass = (const char **) realloc(toPass,(sizeof(char *) *
-              (MAX_SIZE * ((size/MAX_SIZE) +1))));
-        }
+    while (tempTok != NULL) {
+      toPass[size++] = tempTok;
+      if(size == toPassSize) {
+        toPassSize += MAX_SIZE;
+        toPass = (const char **) realloc(toPass,(sizeof(char *) *
+                                         (MAX_SIZE * toPassSize)));
       }
-    } else {
-      toPass[size] = (char *)value;
+      tempTok = strtok_r(NULL, ",", &tempstr);
     }
   }
-  if(size > 0) {
-    toPass[size] = NULL;
-  }
+  toPass[size] = NULL;
   return toPass;
 }
 

Modified: hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/task-controller.c
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/c%2B%2B/task-controller/task-controller.c?rev=1076997&r1=1076996&r2=1076997&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/task-controller.c
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/c++/task-controller/task-controller.c
Fri Mar  4 03:29:04 2011
@@ -91,6 +91,7 @@ int check_tt_root(const char *tt_root) {
       found = 0;
       break;
     }
+    ++mapred_local_dir; 
   }
   free(mapred_local_dir);
   return found;



Mime
View raw message