Skip to content

cleaned up handling of specifying multiple libraries at once#6593

Merged
chrchr-github merged 4 commits intocppcheck-opensource:mainfrom
firewave:lookup-lib-multi
Jul 16, 2024
Merged

cleaned up handling of specifying multiple libraries at once#6593
chrchr-github merged 4 commits intocppcheck-opensource:mainfrom
firewave:lookup-lib-multi

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

No description provided.

@firewave
Copy link
Copy Markdown
Collaborator Author

The GUI only passes a single file to the library loading.

Comment thread lib/utils.cpp
}
}

std::list<std::string> splitString(const std::string& str, char sep)
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.

Let's bikeshed about this unimportant utility function, which seems quite inefficient.

We could use a very short regex version (which also doesn't produce empty strings), or this replacement:

std::list<std::string> splitString2(const std::string& str, char sep)
{
    std::list<std::string> l;
    std::string::size_type pos = 0;
    for (;;) {
        const std::string::size_type newPos = str.find(sep, pos);
        l.push_back(str.substr(pos, newPos - pos));
        if (newPos == std::string::npos) {
            break;
        }
        pos = newPos + 1;
    }
    return l;
}

https://godbolt.org/z/85E8xGThd

Copy link
Copy Markdown
Collaborator Author

@firewave firewave Jul 15, 2024

Choose a reason for hiding this comment

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

I already a simpler version locally (which might be identical to your version) which I will add in a follow-up PR which will also extend its usage. I wanted to keep this topical and not introduce any functional non-refactoring changes.

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 see.
There still is a merge conflict.

@chrchr-github chrchr-github merged commit c7bc7a8 into cppcheck-opensource:main Jul 16, 2024
@firewave firewave deleted the lookup-lib-multi branch July 16, 2024 08:38
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.

2 participants