summaryrefslogtreecommitdiffstats
path: root/src/fundamental/string-util-fundamental.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* string-util-fundamental: postfix -> suffix, use streqMike Yuan2024-01-041-8/+8
|
* fundamental: Drop some unnecessary ifdefsJan Janssen2023-02-211-2/+0
| | | | With gnu-efi headers gone, we don't need these guards anymore.
* meson: use 0|1 for SD_BOOTZbigniew Jędrzejewski-Szmek2023-01-101-2/+2
| | | | | | | We converted to not using #ifdef for most of our defines because the syntax is nicer and we are protected against typos and can set -Werror=undef. Let's do the same for SD_BOOT. The define is nicely hidden in build.h for normal builds, and for EFI builds we were already setting SD_BOOT on the commandline.
* tree-wide: add global ascii_isdigit() + ascii_isalpha()Lennart Poettering2022-07-051-16/+6
| | | | | | | | We now have a local implementation in string-util-fundamental.c, but it's useful at a lot of other places, hence let's give it a more expressive name and share it across the tree. Follow-up for: 8d9156660d6958c8d63b1d44692968f1b5d33920
* fundamental: Remove types-fundamental.hJan Janssen2022-06-271-5/+5
| | | | | | | | | | | | | This removes the fundamental typedefs in favor of just using standard C types. These are all used internally anyway and also do not do anything special to warrant any redefinition to EFI types. Even for BOOLEAN we can safely use stdbool. The defition from the EFI specification is fully compatible, including making any other values than 0/1 as undefined. The exception is sd_char as those need to be char16_t. The typedef is moved to string-util-fundamental.h instead.
* docs/BLS: describe version comparisonsZbigniew Jędrzejewski-Szmek2022-05-251-2/+2
| | | | Fixes #23346.
* basic/string-util: tweak strverscmp_improved() for some corner casesZbigniew Jędrzejewski-Szmek2022-05-251-8/+13
| | | | | | | | | | | So far we had the rule that '' == '', '0_' == '0', but '_' > ''. This means that the general rule that strings are compared iteratively, and each segment that compares equal can be dropped and the comparison resumes at the following characters wasn't true in such cases. Similarly, '0~' < '0', but after dropping the common segment, '~' > ''. The special handling of empty strings is dropped, and '_' == '' and '~' < ''.
* version comparisons: stop using locale-dependent isdigit()Zbigniew Jędrzejewski-Szmek2022-05-191-8/+7
| | | | | | | | The docs are not entirely clear what glyphs qualify as digits. The function is supposed to be locale-dependent, but I couldn't get it to return true on any non-ascii digits I tried. But it's better to be safe than sorry, let's use our trivial replacement instead.
* fundamental: make strverscmp_improved() return -1/0/+1 in all casesZbigniew Jędrzejewski-Szmek2022-05-171-3/+3
| | | | | | | We would return the result of strcmp(), i.e. some positive/negative value. Now that we want to make this a documented interface for other people to implement, let's make the implementation more contstrained, even if we ourselves don't care about whether the specific values.
* fundamental/string-util-fundamental: include appropriate headersZbigniew Jędrzejewski-Szmek2022-05-171-3/+3
| | | | We were using CMP() without pulling the definition in directly.
* Clean up the text in description of strverscmp_improved()Zbigniew Jędrzejewski-Szmek2022-05-171-7/+9
|
* fundamental: define size_t and memcpy for sd-bootLuca Boccassi2021-10-081-4/+4
|
* string-util: trivial optimizations for strverscmp_improved()Yu Watanabe2021-06-021-5/+5
|
* string-util: introduce strverscmp_improved()Yu Watanabe2021-02-091-0/+158
| | | | | | | | Unfortunately, strverscmp() from libc or str_verscmp() do not correctly handle pre-release version, e.g. 247 vs 247~rc1. This implement a new comparison function, which is based on the RPM's rpmvercmp().
* fundamental: move several macros and functions into src/fundamental/Yu Watanabe2021-02-091-0/+76
sd-boot has a copy of a subset of codes from libbasic. This makes sd-boot share the code with libbasic, and dedup the code. Note, startswith_no_case() is dropped from sd-boot, as - it is not used, - the previous implementation is not correct, - gnu-efi does not have StrniCmp() or so.