Commit d37b412e authored by Shane Snyder's avatar Shane Snyder
Browse files

for portability, strsep->strtok & strdupa->strdup

parent 7098d866
...@@ -1085,23 +1085,31 @@ static void darshan_get_exe_and_mounts(struct darshan_core_runtime *core, ...@@ -1085,23 +1085,31 @@ static void darshan_get_exe_and_mounts(struct darshan_core_runtime *core,
{ {
if (my_rank == 0) if (my_rank == 0)
fprintf(stderr, "INFO: darshan will exclude these dirs: %s\n",env_exclusions); fprintf(stderr, "INFO: darshan will exclude these dirs: %s\n",env_exclusions);
string = strdupa(env_exclusions); string = strdup(env_exclusions);
i = 0; i = 0;
/* get the comma separated number of directories */ /* get the comma separated number of directories */
while ((token = strsep(&string, ",")) != NULL) token = strtok(string, ",");
while (token != NULL)
{ {
i++; i++;
token = strtok(NULL, ",");
} }
user_darshan_path_exclusions=(char **)malloc((i+1)*sizeof(char *)); user_darshan_path_exclusions=(char **)malloc((i+1)*sizeof(char *));
assert(user_darshan_path_exclusions);
i = 0; i = 0;
string = strdupa(env_exclusions); strcpy(string, env_exclusions);
while ((token = strsep(&string, ",")) != NULL) token = strtok(string, ",");
while (token != NULL)
{ {
user_darshan_path_exclusions[i]=(char *)malloc(strlen(token)+1); user_darshan_path_exclusions[i]=(char *)malloc(strlen(token)+1);
assert(user_darshan_path_exclusions[i]);
strcpy(user_darshan_path_exclusions[i],token); strcpy(user_darshan_path_exclusions[i],token);
i++; i++;
token = strtok(NULL, ",");
} }
user_darshan_path_exclusions[i]=NULL; user_darshan_path_exclusions[i]=NULL;
free(string);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment