]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Clean up the text in description of strverscmp_improved()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 17 May 2022 11:26:47 +0000 (13:26 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 17 May 2022 14:33:43 +0000 (16:33 +0200)
docs/DISCOVERABLE_PARTITIONS.md
src/fundamental/string-util-fundamental.c

index 85e858921fb8478d562feb643cc89169c6f7de5c..b7c9c1e2ebf1c35b5af5a9d458c514c8baa235b6 100644 (file)
@@ -333,11 +333,11 @@ directory is found to be populated already in the root partition, the automatic
 discovery _must not_ mount any discovered file system over it. Optionally, in
 case of the root, `/usr/` and their Verity partitions instead of strictly
 mounting the first suitable partition an OS might choose to mount the partition
-whose label compares the highest according to `strverscmp()` or a similar
-logic, in order to implement a simple partition-based A/B versioning
-scheme. The precise rules are left for the implementation to decide, but when
-in doubt earlier partitions (by their index) should always win over later
-partitions if the label comparison is inconclusive.
+whose label compares the highest according to `strverscmp()` or similar logic,
+in order to implement a simple partition-based A/B versioning scheme. The
+precise rules are left for the implementation to decide, but when in doubt
+earlier partitions (by their index) should always win over later partitions if
+the label comparison is inconclusive.
 
 A *container* *manager* should automatically discover and mount the root,
 `/usr/`, `/home/`, `/srv/`, `/var/`, `/var/tmp/` partitions inside a container
index 101d3f71962ceedf4290e2fdc7151564c41b21ca..c9b1b89b3e99ecd790264b25e5f91eeb1e16bb36 100644 (file)
@@ -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