From 9338360555c74f4eaf588f50ec702f2ad3209fa8 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 31 Jul 2015 11:33:03 +0100 Subject: [PATCH] Skip duplicate entries when listing concept values --- src/action_class_concept.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/action_class_concept.c b/src/action_class_concept.c index 6bbd461c4..c5f1b44bb 100644 --- a/src/action_class_concept.c +++ b/src/action_class_concept.c @@ -402,13 +402,18 @@ int grib_concept_apply(grib_handle* h,grib_action* act,const char* name) pCon = pCon->next; } count = i; - /* Printing out all values for concepts like paramId will be silly! */ + /* Only print out all concepts if fewer than MAX_NUM_CONCEPT_VALUES. + * Printing out all values for concepts like paramId would be silly! */ if (count < MAX_NUM_CONCEPT_VALUES) { fprintf(stderr, "Here are the possible values for concept %s:\n", act->name); qsort(&all_concept_vals, count, sizeof(char*), cmpstringp); for(i=0; i0 && strcmp(all_concept_vals[i], all_concept_vals[i-1]) == 0) { + print_it = 0; /* skip duplicate entries */ + } + if (print_it) fprintf(stderr, "\t%s\n", all_concept_vals[i]); } } }