Skip to content

Refactor char** array to string collection in upssched and other code #3111

@jimklimov

Description

@jimklimov

PRs like #3097 and #3095 introduced some copy-pasta creep into NUT code base (with collect_string and analyze_mapping_usage methods in particular), which would do well to be refactored into some shared implementation of what is currently nuancely-different code.

Maybe we can refactor the data structure involved here, to merge code with common str_add_unique_token etc. methods?

Code parked in PR #2476 can also be useful here, modulo that use-cases to be refactored also want to add separators - so another argument to something like that str_concat() method. Currently the in-tree code uses a sentinel NULL to end off the array of strings, and str_concat() uses a count argument with varargs to limit the stack walk. Not sure if one approach is fully better over the other, or they just fit different use-cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-strIssues and PRs about C/C++ methods, headers and data types dealing with strings and memory blocksrefactor/fightwarnPR or issue proposal to improve code maintainability without functional changes, or to fix warnings

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions