Skip to content

Commit

Permalink
ldmsd_row_cache: fix tree_comparator() function
Browse files Browse the repository at this point in the history
Fix the tree_comparator function to continue on to comparing
the following keys if the current keys are equal.
  • Loading branch information
morrone committed Aug 15, 2024
1 parent 4be486e commit ca94400
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ldms/src/ldmsd/ldmsd_row_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static int tree_comparator(void *a, const void *b)
ldmsd_row_cache_idx_t key_a = (ldmsd_row_cache_idx_t)a;
ldmsd_row_cache_idx_t key_b = (ldmsd_row_cache_idx_t)b;
ldmsd_row_cache_key_t rowk_a, rowk_b;
int rc;
assert(key_a->key_count == key_b->key_count);
for (i = 0; i < key_a->key_count; i++) {
rowk_a = key_a->keys[i];
Expand All @@ -55,10 +56,13 @@ static int tree_comparator(void *a, const void *b)
return -1;
if (rowk_a->mval->v_ts.usec > rowk_b->mval->v_ts.usec)
return 1;
return 0;
continue;
case LDMS_V_CHAR_ARRAY:
return strncmp(rowk_a->mval->a_char, rowk_b->mval->a_char,
rowk_a->count);
rc = strncmp(rowk_a->mval->a_char, rowk_b->mval->a_char,
rowk_a->count);
if (rc != 0)
return rc;
continue;
case LDMS_V_CHAR:
if (rowk_a->mval->v_char == rowk_b->mval->v_char)
continue;
Expand Down

0 comments on commit ca94400

Please sign in to comment.