[Darshan-commits] [Git][darshan/darshan][dev-modular] minor bug fix in darshan-diff tool

Shane Snyder xgitlab at cels.anl.gov
Wed Jan 13 13:29:32 CST 2016


Shane Snyder pushed to branch dev-modular at darshan / darshan


Commits:
b770409e by Shane Snyder at 2016-01-13T13:29:12Z
minor bug fix in darshan-diff tool

- - - - -


1 changed file:

- darshan-util/darshan-diff.c


Changes:

=====================================
darshan-util/darshan-diff.c
=====================================
--- a/darshan-util/darshan-diff.c
+++ b/darshan-util/darshan-diff.c
@@ -408,11 +408,24 @@ static int darshan_build_global_record_hash(
                 mod_rec->rank = base_rec->rank;
 
                 HASH_FIND(hlink, *rec_hash, &tmp_rec_id, sizeof(darshan_record_id), file_rec);
-                if(file_rec)
+                if(!file_rec)
                 {
-                    /* the global record already exists, so we need to just add the
-                     * module record to the linked list of records for this module
+                    /* there is no entry in the global hash table of darshan records
+                     * for this log file, so create one and add it.
                      */
+                    file_rec = malloc(sizeof(struct darshan_file_record_ref));
+                    assert(file_rec);
+
+                    memset(file_rec, 0, sizeof(struct darshan_file_record_ref));
+                    file_rec->rec_id = tmp_rec_id;
+                    HASH_ADD(hlink, *rec_hash, rec_id, sizeof(darshan_record_id), file_rec);
+
+                }
+
+                /* add new record into the linked list of this module's records */
+                if(file_rec->mod_recs[i])
+                {
+                    /* there is already an initialized linked list for this module */
 
                     /* we start at the end of the list and work backwards to insert this
                      * record (the list is sorted according to increasing ranks, and in
@@ -449,17 +462,9 @@ static int darshan_build_global_record_hash(
                 }
                 else
                 {
-                    /* there is no entry in the global hash table of darshan records
-                     * for this log file, so create one and add it.
+                    /* there are currently no records for this module, so just
+                     * initialize a new linked list
                      */
-                    file_rec = malloc(sizeof(struct darshan_file_record_ref));
-                    assert(file_rec);
-
-                    memset(file_rec, 0, sizeof(struct darshan_file_record_ref));
-                    file_rec->rec_id = tmp_rec_id;
-                    HASH_ADD(hlink, *rec_hash, rec_id, sizeof(darshan_record_id), file_rec);
-
-                    /* also, add this record to this module's linked list of records */
                     mod_rec->prev = mod_rec->next = mod_rec;
                     file_rec->mod_recs[i] = mod_rec;
                 }



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/commit/b770409e461781a9723c194b0c76e27620eefa79
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20160113/e45e42e6/attachment.html>


More information about the Darshan-commits mailing list