Hi,

I added an MCA parameter and I want the user to apply an Hex value to this parameter (0x…).

In order to do so I needed to change the ‘atoi’ call in the mca_base_param.c file to ‘strtol’ call.

 

My question is: Can this code run on all platforms?

 

Index: opal/mca/base/mca_base_param.c

===================================================================

--- opal/mca/base/mca_base_param.c     (revision 14391)

+++ opal/mca/base/mca_base_param.c  (working copy)

@@ -1673,7 +1673,7 @@

   if (NULL != param->mbp_env_var_name &&

       NULL != (env = getenv(param->mbp_env_var_name))) {

     if (MCA_BASE_PARAM_TYPE_INT == param->mbp_type) {

-      storage->intval = atoi(env);

+      storage->intval = strtol(env,(char**)NULL,0);

     } else if (MCA_BASE_PARAM_TYPE_STRING == param->mbp_type) {

       storage->stringval = strdup(env);

     }

@@ -1714,7 +1714,7 @@

         if (0 == strcmp(fv->mbpfv_param, param->mbp_full_name)) {

             if (MCA_BASE_PARAM_TYPE_INT == param->mbp_type) {

                 if (NULL != fv->mbpfv_value) {

-                    param->mbp_file_value.intval = atoi(fv->mbpfv_value);

+                    param->mbp_file_value.intval = strtol(fv->mbpfv_value,(char**)NULL,0);

                 } else {

                     param->mbp_file_value.intval = 0;

                 }

 

 

Thanks.

 

Sharon.