summaryrefslogtreecommitdiff
path: root/src/fundamental
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-05-17 13:26:47 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-05-17 16:33:43 +0200
commit68df2df66857b597a2adbb29d27d709a5d59a5a3 (patch)
tree40f957383913f6966755c125cb7bb75dc45d409e /src/fundamental
parent9b7c8253f9d396edcee0dac4e8155ae1dac93bc4 (diff)
downloadsystemd-68df2df66857b597a2adbb29d27d709a5d59a5a3.tar.gz
Clean up the text in description of strverscmp_improved()
Diffstat (limited to 'src/fundamental')
-rw-r--r--src/fundamental/string-util-fundamental.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/fundamental/string-util-fundamental.c b/src/fundamental/string-util-fundamental.c
index 101d3f7196..c9b1b89b3e 100644
--- a/src/fundamental/string-util-fundamental.c
+++ b/src/fundamental/string-util-fundamental.c
@@ -93,20 +93,22 @@ static sd_bool is_valid_version_char(sd_char a) {
}
sd_int strverscmp_improved(const sd_char *a, const sd_char *b) {
-
- /* This is based on RPM's rpmvercmp(). But this explicitly handles '-' and '.', as we usually
- * want to directly compare strings which contain both version and release; e.g.
+ /* This function is similar to strverscmp(3), but it treats '-' and '.' as separators.
+ *
+ * The logic is based on rpm's rpmvercmp(), but unlike rpmvercmp(), it distiguishes e.g.
+ * '123a' and '123.a', with '123a' being newer.
+ *
+ * It allows direct comparison of strings which contain both a version and a release; e.g.
* '247.2-3.1.fc33.x86_64' or '5.11.0-0.rc5.20210128git76c057c84d28.137.fc34'.
- * Unlike rpmvercmp(), this distiguishes e.g. 123a and 123.a, and 123a is newer.
*
- * This splits the input strings into segments. Each segment is numeric or alpha, and may be
+ * The input string is split into segments. Each segment is numeric or alphabetic, and may be
* prefixed with the following:
* '~' : used for pre-releases, a segment prefixed with this is the oldest,
* '-' : used for the separator between version and release,
* '^' : used for patched releases, a segment with this is newer than one with '-'.
* '.' : used for point releases.
- * Note, no prefix segment is the newest. All non-supported characters are dropped, and
- * handled as a separator of segments, e.g., 123_a is equivalent to 123a.
+ * Note that no prefix segment is the newest. All non-supported characters are dropped, and
+ * handled as a separator of segments, e.g., '123_a' is equivalent to '123a'.
*
* By using this, version strings can be sorted like following:
* (older) 122.1