Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

From: Brian W. Barrett (bbarrett_at_[hidden])
Date: 2007-04-18 11:08:10


The patch is so that you can pass in hex in addition to decimal, right? I
think that makes sense. But since we're switching to strtol, it might
also make sense to add some error detection while we're at it. Not a huge
deal, but it would be nice :).

Brian

> Hi,
>
> I want to add a patch to opal mca.
>
> This patch replaces an 'atoi' call with a 'strtol' call.
>
> If it's O.K with everyone I'll submit this patch by the end of the week.
>
>
>
> 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 = (int)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 =
> (int)strtol(fv->mbpfv_value,(char**)NULL,0);
>
> } else {
>
> param->mbp_file_value.intval = 0;
>
> }
>
>
>
> Thanks.
>
>
>
> Sharon.
>
> _______________________________________________
> devel mailing list
> devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/devel