Tools: Refactoring

This commit is contained in:
Shahram Najm 2023-12-23 13:05:12 +00:00
parent d3ff8fc086
commit d670455ff0
2 changed files with 5 additions and 9 deletions

View File

@ -1311,7 +1311,7 @@ static int compare_handles(grib_handle* handle1, grib_handle* handle2, grib_runt
if (options->compare[i].type == CODES_NAMESPACE) {
iter = grib_keys_iterator_new(handle1, 0, options->compare[i].name);
if (!iter) {
grib_context_log(handle1->context, GRIB_LOG_ERROR, "unable to get iterator");
grib_context_log(handle1->context, GRIB_LOG_ERROR, "unable to create the BUFR keys iterator");
exit(1);
}
while (grib_keys_iterator_next(iter)) {
@ -1372,12 +1372,11 @@ static int compare_handles(grib_handle* handle1, grib_handle* handle2, grib_runt
iter = grib_keys_iterator_new(handle1, 0, options->compare[i].name);
if (!iter) {
grib_context_log(handle1->context, GRIB_LOG_ERROR,
"ERROR: unable to get keys iterator for %s", options->compare[i].name);
"unable to create the BUFR keys iterator for %s", options->compare[i].name);
exit(1);
}
while (grib_keys_iterator_next(iter)) {
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blocklisted(name))
continue;

View File

@ -1227,7 +1227,6 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
h22 = grib_handle_new_from_partial_message(h1->context, msg2, size2);
iter = grib_keys_iterator_new(h11, GRIB_KEYS_ITERATOR_SKIP_COMPUTED, NULL);
if (!iter) {
grib_context_log(context, GRIB_LOG_ERROR, "unable to create the GRIB keys iterator");
exit(1);
@ -1235,7 +1234,6 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
while (grib_keys_iterator_next(iter)) {
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blocklisted(name))
continue;
@ -1258,7 +1256,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
int num_keys_in_namespace = 0;
iter = grib_keys_iterator_new(h1, 0, options->compare[i].name);
if (!iter) {
printf("ERROR: unable to get keys iterator for namespace \"%s\".\n", options->compare[i].name);
grib_context_log(context, GRIB_LOG_ERROR, "unable to create the GRIB keys iterator for %s", options->compare[i].name);
exit(1);
}
while (grib_keys_iterator_next(iter)) {
@ -1292,9 +1290,8 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
return 0;
iter = grib_keys_iterator_new(h1, GRIB_KEYS_ITERATOR_SKIP_COMPUTED, NULL);
if (!iter) {
printf("ERROR: unable to get keys iterator\n");
grib_context_log(context, GRIB_LOG_ERROR, "unable to create the GRIB keys iterator");
exit(1);
}
@ -1318,7 +1315,7 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
if (options->compare[i].type == CODES_NAMESPACE) {
iter = grib_keys_iterator_new(h1, 0, options->compare[i].name);
if (!iter) {
printf("ERROR: unable to get iterator for %s\n", options->compare[i].name);
fprintf(stderr, "Error: unable to get keys iterator for %s\n", options->compare[i].name);
exit(1);
}
while (grib_keys_iterator_next(iter)) {