summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/string_view.h
Commit message (Collapse)AuthorAgeFilesLines
* Modernize standard library includesJulian Andres Klode2024-02-201-1/+1
| | | | | | This was automated with sed and git-clang-format, and then I had to fix up the top of policy.cc by hand as git-clang-format accidentally indented it by two spaces.
* Avoid overstepping bounds in config file parsingDavid Kalnischkies2021-02-031-0/+26
| | | | | | | Our configuration files are not security relevant, but having a parser which avoids crashing on them even if they are seriously messed up is not a bad idea anyway. It is also a good opportunity to brush up the code a bit avoiding a few small string copies with our string_view.
* StringView: Implement operator ""_svJulian Andres Klode2020-02-031-1/+4
| | | | This allows us to define constexpr string view literals.
* Allow comparing string to StringViewJulian Andres Klode2019-06-111-0/+2
|
* Make APT::StringView publicJulian Andres Klode2019-06-111-2/+2
|
* Reformat and sort all includes with clang-formatJulian Andres Klode2017-07-121-2/+2
| | | | | | | | | | | | | This makes it easier to see which headers includes what. The changes were done by running git grep -l '#\s*include' \ | grep -E '.(cc|h)$' \ | xargs sed -i -E 's/(^\s*)#(\s*)include/\1#\2 include/' To modify all include lines by adding a space, and then running ./git-clang-format.sh.
* Compare size before data when ordering cache bucket entriesJulian Andres Klode2016-11-221-0/+11
| | | | | | | This has the effect of significantly reducing actual string comparisons, and should improve the performance of FindGrp a bit, although it's hardly measureable (callgrind says it uses 10% instructions less now).
* Set hidden visibility for StringViewJulian Andres Klode2016-03-241-1/+2
| | | | | | | This avoids templates using StringView to be exported, such as std::vector<StringView*>::emplace_back(). Gbp-Dch: ignore
* string_view: Drop constexpr constructor for standard compatibilityJulian Andres Klode2016-01-151-10/+4
| | | | | | | | | | | | | APT::StringView is supposed to be a temporary measure, until support for the standardized string_view is widely available. Introducing additional unstandardized features just makes porting to the standard version harder. The constexpr constructor also won't have any real effect on most systems, as the compiler will happily optimise the strlen() call away for constant strings. Gbp-Dch: ignore
* provide a constexpr char[] overload for APT::StringViewDavid Kalnischkies2016-01-151-4/+10
| | | | | | The commit also adds a few trivial tests Git-Dch: Ignore
* return correct position in APT::StringView::(r)findDavid Kalnischkies2016-01-151-8/+16
| | | | | | | The position returned is supposed to be the position of the character counted from the start of the string, but if we used the substr calling overloads the skipped over prefix wasn't considered. The pos parameter of rfind had also the wrong semantic.
* operator==(char*, StringView) use StringView.operator==Julian Andres Klode2016-01-081-1/+1
| | | | | | | | Use the same path for both comparisons, as the operator== path is faster than just calling compare() - it avoids any comparison if the size differs. Gbp-Dch: ignore
* StringView: rfind: pos should be end of substr, not startJulian Andres Klode2016-01-071-1/+1
| | | | Gbp-Dch: ignore
* StringView: pos argument default should be nposJulian Andres Klode2016-01-071-2/+2
| | | | Gbp-Dch: ignore
* StringView::rfind(): Call rfind() instead of find() on substJulian Andres Klode2016-01-071-1/+1
| | | | | Thanks: Niels Thykier for reporting on IRC Gbp-Dch: ignore
* Introduce internal APT::StringView classJulian Andres Klode2016-01-071-0/+112
The class APT::StringView implements a drop-in replacement for a subset of C++17 std::string_view() features. It will be dropped at a later point and may not be used in public interfaces.