Remove unused utilities - #1275
Conversation
4201598 to
dfb9104
Compare
There was a problem hiding this comment.
Pull request overview
This PR removes a set of unused utility modules (and their tests/headers), and updates the build and call sites to stop compiling or including those components.
Changes:
- Removed unused utility implementations and public headers (hash, path_stack, string_util, type_vector_functions, and several
util.*helpers). - Updated CMake target sources/tests to stop building removed utilities and tests, and removed bool-vector generation.
- Cleaned up now-unused includes and updated vector template documentation example.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/util/vector_template.cpp.in | Updates documentation example after removing bool-vector references. |
| lib/util/util.cpp | Removes several unused utility functions. |
| lib/util/type_vector_functions.cpp | Removes unused type-vector helper implementation. |
| lib/util/tests/test_thread_pool.cpp | Removes unused thread_pool test. |
| lib/util/tests/ert_util_type_vector_test.cpp | Removes type-vector test binary source. |
| lib/util/tests/ert_util_type_vector_functions.cpp | Removes tests for removed type_vector_functions. |
| lib/util/tests/ert_util_string_util.cpp | Removes tests for removed string_util. |
| lib/util/tests/ert_util_sscan_test.cpp | Drops tests for removed util_sscanf_* helpers and cleans includes. |
| lib/util/tests/ert_util_path_stack_test.cpp | Removes tests for removed path_stack. |
| lib/util/tests/ert_util_normal_path.cpp | Removes tests for removed normal-path helper. |
| lib/util/tests/ert_util_cwd_test.cpp | Removes tests for removed cwd helper. |
| lib/util/tests/ert_util_copy_file.cpp | Removes unused string_util include. |
| lib/util/string_util.cpp | Removes unused string utility implementation. |
| lib/util/path_stack.cpp | Removes unused path stack implementation. |
| lib/util/hash.cpp | Removes unused hash implementation. |
| lib/util/hash_sll.cpp | Removes unused hash SLL implementation. |
| lib/util/hash_node.cpp | Removes unused hash node implementation. |
| lib/resdata/tests/rd_kw_init.cpp | Removes unused bool_vector include. |
| lib/resdata/rd_sum.cpp | Removes unused hash include. |
| lib/resdata/rd_subsidence.cpp | Removes unused hash include. |
| lib/resdata/rd_smspec.cpp | Removes unused hash include. |
| lib/include/ert/util/util.hpp | Removes declarations for utilities being removed/hidden from the public API. |
| lib/include/ert/util/type_vector_functions.hpp | Removes unused public header. |
| lib/include/ert/util/string_util.hpp | Removes unused public header. |
| lib/include/ert/util/path_stack.hpp | Removes unused public header. |
| lib/include/ert/util/hash.hpp | Removes unused public header. |
| lib/include/ert/util/hash_sll.hpp | Removes unused public header. |
| lib/include/ert/util/hash_node.hpp | Removes unused public header. |
| lib/CMakeLists.txt | Removes removed sources/tests from the build and drops bool-vector generation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
f2be459 to
db397f8
Compare
32e0277 to
47a97db
Compare
47a97db to
c91fa2c
Compare
c91fa2c to
db02970
Compare
ajaust
left a comment
There was a problem hiding this comment.
Looks good. I found the implementation of one method that you might be able to delete since its declaration was removed from util.hpp.
| /** | ||
| This function parses a string literal (hopfully) containing a | ||
| represantation of a double. The return value is true|false depending | ||
| on the success of the parse operation, the parsed value is returned | ||
| by reference. | ||
|
|
||
|
|
||
| Example: | ||
| -------- | ||
| const char * s = "78.92" | ||
| double value; | ||
|
|
||
| if (util_sscanf_double(s , &value)) | ||
| printf("%s is a valid double\n"); | ||
| else | ||
| printf("%s is NOT a valid double\n"); | ||
|
|
||
| */ | ||
|
|
||
| bool util_sscanf_double(const char *buffer, double *value) { | ||
| if (!buffer) | ||
| return false; | ||
|
|
||
| bool value_OK = false; | ||
| char *error_ptr; | ||
|
|
||
| double tmp_value = strtod(buffer, &error_ptr); | ||
| /* | ||
| Skip trailing white-space | ||
| */ | ||
| while (error_ptr[0] != '\0' && isspace(error_ptr[0])) | ||
| error_ptr++; | ||
|
|
||
| if (error_ptr[0] == '\0') { | ||
| value_OK = true; | ||
| if (value != NULL) | ||
| *value = tmp_value; | ||
| } | ||
| return value_OK; | ||
| } |
There was a problem hiding this comment.
I think the declaration of this method was removed from the header. If the method is not used internally, we can probably delete it as well.
No description provided.