Skip to content

Remove unused utilities - #1275

Open
eivindjahren wants to merge 8 commits into
mainfrom
remove_unused_utilities
Open

Remove unused utilities#1275
eivindjahren wants to merge 8 commits into
mainfrom
remove_unused_utilities

Conversation

@eivindjahren

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/util/vector_template.cpp.in
Comment thread lib/include/ert/util/util.hpp
@eivindjahren
eivindjahren force-pushed the remove_unused_utilities branch 4 times, most recently from f2be459 to db397f8 Compare August 20, 2026 16:26
Base automatically changed from remove_bool_vector_type to main August 21, 2026 06:47
@eivindjahren
eivindjahren force-pushed the remove_unused_utilities branch 4 times, most recently from 32e0277 to 47a97db Compare August 21, 2026 07:42
@eivindjahren
eivindjahren force-pushed the remove_unused_utilities branch from 47a97db to c91fa2c Compare August 21, 2026 07:44
@eivindjahren
eivindjahren force-pushed the remove_unused_utilities branch from c91fa2c to db02970 Compare August 21, 2026 07:44

@ajaust ajaust left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I found the implementation of one method that you might be able to delete since its declaration was removed from util.hpp.

Comment thread lib/util/util.cpp
Comment on lines 838 to 877
/**
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;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants