diff --git a/src/eccodes.cc b/src/eccodes.cc index 0bd5cc78a..9ec6d8073 100644 --- a/src/eccodes.cc +++ b/src/eccodes.cc @@ -175,9 +175,9 @@ grib_handle* codes_handle_clone(const grib_handle* h) { return grib_handle_clone(h); } -grib_handle* codes_handle_clone_lightweight(const grib_handle* h) +grib_handle* codes_handle_clone_headers_only(const grib_handle* h) { - return grib_handle_clone_lightweight(h); + return grib_handle_clone_headers_only(h); } int codes_handle_delete(grib_handle* h) diff --git a/src/eccodes.h b/src/eccodes.h index 58784768f..7a535808e 100644 --- a/src/eccodes.h +++ b/src/eccodes.h @@ -495,7 +495,7 @@ codes_handle* codes_handle_new_from_samples(codes_context* c, const char* sample * @return the new handle, NULL if the message is invalid or a problem is encountered */ codes_handle* codes_handle_clone(const codes_handle* h); -codes_handle* codes_handle_clone_lightweight(const codes_handle* h); +codes_handle* codes_handle_clone_headers_only(const codes_handle* h); /** * Frees a handle, also frees the message if it is not a user message diff --git a/src/grib_api.h b/src/grib_api.h index 4f74189c6..84566b108 100644 --- a/src/grib_api.h +++ b/src/grib_api.h @@ -507,7 +507,7 @@ grib_handle* grib_handle_new_from_samples(grib_context* c, const char* sample_na * @return the new handle, NULL if the message is invalid or a problem is encountered */ grib_handle* grib_handle_clone(const grib_handle* h); -grib_handle* grib_handle_clone_lightweight(const grib_handle* h); +grib_handle* grib_handle_clone_headers_only(const grib_handle* h); /** * Frees a handle, also frees the message if it is not a user message diff --git a/src/grib_handle.cc b/src/grib_handle.cc index 8a06e2a68..c5e7b9960 100644 --- a/src/grib_handle.cc +++ b/src/grib_handle.cc @@ -326,7 +326,7 @@ grib_handle* grib_handle_clone(const grib_handle* h) return result; } -static bool can_create_clone_lightweight(const grib_handle* h) +static bool can_create_clone_headers_only(const grib_handle* h) { // Only for GRIB, not BUFR etc if (h->product_kind != PRODUCT_GRIB) return false; @@ -339,14 +339,14 @@ static bool can_create_clone_lightweight(const grib_handle* h) return true; } -grib_handle* grib_handle_clone_lightweight(const grib_handle* h) +grib_handle* grib_handle_clone_headers_only(const grib_handle* h) { int err = 0; grib_handle* result = NULL; grib_context* c = h->context; - if (!can_create_clone_lightweight(h)) { - // Lightweight clone not possible. Do a normal clone + if (!can_create_clone_headers_only(h)) { + // Headers-only clone not possible. Do a normal clone return grib_handle_clone(h); } @@ -356,7 +356,7 @@ grib_handle* grib_handle_clone_lightweight(const grib_handle* h) snprintf(sample_name, sizeof(sample_name), "GRIB%ld", edition); grib_handle* h_sample = grib_handle_new_from_samples(c, sample_name); if (!h_sample) { - grib_context_log(c, GRIB_LOG_ERROR, "Failed to create lightweight clone using sample %s", sample_name); + grib_context_log(c, GRIB_LOG_ERROR, "Failed to create headers_only clone using sample %s", sample_name); return NULL; } @@ -372,7 +372,7 @@ grib_handle* grib_handle_clone_lightweight(const grib_handle* h) const int sections_to_copy = GRIB_SECTION_PRODUCT | GRIB_SECTION_LOCAL | GRIB_SECTION_GRID; result = grib_util_sections_copy((grib_handle*)h, h_sample, sections_to_copy, &err); if (!result || err) { - grib_context_log(c, GRIB_LOG_ERROR, "Failed to create lightweight clone: Unable to copy sections"); + grib_context_log(c, GRIB_LOG_ERROR, "Failed to create headers_only clone: Unable to copy sections"); grib_handle_delete(h_sample); return NULL; } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 686d63b93..656817b17 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -17,7 +17,7 @@ list(APPEND test_c_bins grib_indexing grib_fieldset grib_multi_from_message - grib_clone_lightweight + grib_clone_headers_only grib_read_index unit_tests bufr_keys_iter @@ -172,7 +172,7 @@ if( HAVE_BUILD_TOOLS ) grib_headers_only grib_unpack_subarray grib_count - grib_clone_lightweight + grib_clone_headers_only bufr_templates bufr_dump_data bufr_dump_descriptors diff --git a/tests/grib_clone_lightweight.cc b/tests/grib_clone_headers_only.cc similarity index 97% rename from tests/grib_clone_lightweight.cc rename to tests/grib_clone_headers_only.cc index 3ee8c545b..f59b204ed 100644 --- a/tests/grib_clone_lightweight.cc +++ b/tests/grib_clone_headers_only.cc @@ -42,7 +42,7 @@ int main(int argc, char* argv[]) assert(out); while ((source_handle = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err)) != NULL) { - codes_handle* clone_handle = codes_handle_clone_lightweight(source_handle); + codes_handle* clone_handle = codes_handle_clone_headers_only(source_handle); assert(clone_handle); codes_get_long(source_handle, "isConstant", &isConstant_src); diff --git a/tests/grib_clone_lightweight.sh b/tests/grib_clone_headers_only.sh similarity index 87% rename from tests/grib_clone_lightweight.sh rename to tests/grib_clone_headers_only.sh index 3e87f8c64..8675f38cb 100755 --- a/tests/grib_clone_lightweight.sh +++ b/tests/grib_clone_headers_only.sh @@ -10,7 +10,7 @@ . ./include.ctest.sh -label="grib_clone_lightweight_test" +label="grib_clone_headers_only_test" temp=temp.$label.grib inputs=" @@ -22,7 +22,7 @@ inputs=" for f in $inputs; do infile=$data_dir/$f rm -f $temp - $EXEC ${test_dir}/grib_clone_lightweight $infile $temp + $EXEC ${test_dir}/grib_clone_headers_only $infile $temp ${tools_dir}/grib_compare -H -b totalLength $infile $temp done