[Darshan-commits] [Git][darshan/darshan][master] 3 commits: for portability, strsep->strtok & strdupa->strdup

Shane Snyder xgitlab at cels.anl.gov
Tue Apr 25 13:26:04 CDT 2017


Shane Snyder pushed to branch master at darshan / darshan


Commits:
d37b412e by Shane Snyder at 2017-04-25T13:07:56-05:00
for portability, strsep->strtok & strdupa->strdup

- - - - -
2a96faf8 by Shane Snyder at 2017-04-25T13:11:27-05:00
cleanup darshan info messages

- - - - -
adbdab59 by Shane Snyder at 2017-04-25T13:22:08-05:00
Merge branch 'csimarro/darshan-exclude-dirs'

- - - - -


1 changed file:

- darshan-runtime/lib/darshan-core.c


Changes:

=====================================
darshan-runtime/lib/darshan-core.c
=====================================
--- a/darshan-runtime/lib/darshan-core.c
+++ b/darshan-runtime/lib/darshan-core.c
@@ -1078,30 +1078,39 @@ static void darshan_get_exe_and_mounts(struct darshan_core_runtime *core,
         if(strncmp(env_exclusions,"none",strlen(env_exclusions))>=0)
         {
             if (my_rank == 0) 
-                fprintf(stderr, "INFO: no system dir will be excluded\n");
+                fprintf(stderr, "Darshan info: no system dirs will be excluded\n");
             darshan_path_exclusions[0]=NULL;
         }
         else
         {
             if (my_rank == 0) 
-                fprintf(stderr, "INFO: darshan will exclude these dirs: %s\n",env_exclusions);
-            string = strdupa(env_exclusions);
+                fprintf(stderr, "Darshan info: the following system dirs will be excluded: %s\n",
+                    env_exclusions);
+            string = strdup(env_exclusions);
             i = 0;
             /* 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 *));
+            assert(user_darshan_path_exclusions);
+
             i = 0;
-            string = strdupa(env_exclusions);
-            while ((token = strsep(&string, ",")) != NULL)
+            strcpy(string, env_exclusions);
+            token = strtok(string, ",");
+            while (token != NULL)
             {
                 user_darshan_path_exclusions[i]=(char *)malloc(strlen(token)+1);
+                assert(user_darshan_path_exclusions[i]);
                 strcpy(user_darshan_path_exclusions[i],token);
                 i++;
+                token = strtok(NULL, ",");
             }
             user_darshan_path_exclusions[i]=NULL;
+            free(string);
         }
     }
 



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/fc190c1a51c8ee9604489c46a9ef7b302a1cd534...adbdab59c0b4d6fe7fdb395b2fb6bda3170c5771


More information about the Darshan-commits mailing list