summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-04-08 15:10:25 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-04-11 11:49:23 +0200
commit7ef43c78dfb2abf3f3b98b325c10f2ca347f4c72 (patch)
treedf7270071f503edcdb95ea007f9cd08c42039687 /src
parentos-util: shorten temporal variable names (diff)
downloadsystemd-7ef43c78dfb2abf3f3b98b325c10f2ca347f4c72.tar.xz
systemd-7ef43c78dfb2abf3f3b98b325c10f2ca347f4c72.zip
os-util: invert order of arguments in extension release parser
For consistency with other functions. Unfortunately, va_start() requires that the previous argument is a pointer, hence the order of the arguments in the internal function cannot be changed.
Diffstat (limited to 'src')
-rw-r--r--src/basic/os-util.h2
-rw-r--r--src/test/test-os-util.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/basic/os-util.h b/src/basic/os-util.h
index bd9e8949e6..e6acf21195 100644
--- a/src/basic/os-util.h
+++ b/src/basic/os-util.h
@@ -33,7 +33,7 @@ int open_os_release(const char *root, char **ret_path, int *ret_fd);
int _parse_extension_release(const char *root, ImageClass image_class, bool relax_extension_release_check, const char *extension, ...) _sentinel_;
int _parse_os_release(const char *root, ...) _sentinel_;
-#define parse_extension_release(root, image_class, relax_extension_release_check, extension, ...) _parse_extension_release(root, image_class, relax_extension_release_check, extension, __VA_ARGS__, NULL)
+#define parse_extension_release(root, image_class, extension, relax_extension_release_check, ...) _parse_extension_release(root, image_class, relax_extension_release_check, extension, __VA_ARGS__, NULL)
#define parse_os_release(root, ...) _parse_os_release(root, __VA_ARGS__, NULL)
int load_extension_release_pairs(const char *root, ImageClass image_class, const char *extension, bool relax_extension_release_check, char ***ret);
diff --git a/src/test/test-os-util.c b/src/test/test-os-util.c
index 94680389fd..84e55e1754 100644
--- a/src/test/test-os-util.c
+++ b/src/test/test-os-util.c
@@ -75,7 +75,7 @@ TEST(parse_extension_release) {
if (r < 0)
log_error_errno(r, "Failed to write file: %m");
- assert_se(parse_extension_release(tempdir, IMAGE_SYSEXT, false, "test", "ID", &id, "VERSION_ID", &version_id) == 0);
+ assert_se(parse_extension_release(tempdir, IMAGE_SYSEXT, "test", false, "ID", &id, "VERSION_ID", &version_id) == 0);
log_info("ID: %s VERSION_ID: %s", id, version_id);
assert_se(streq(id, "the-id"));
assert_se(streq(version_id, "the-version-id"));
@@ -87,16 +87,16 @@ TEST(parse_extension_release) {
if (r < 0)
log_error_errno(r, "Failed to write file: %m");
- assert_se(parse_extension_release(tempdir, IMAGE_CONFEXT, false, "tester", "ID", &id, "VERSION_ID", &version_id) == 0);
+ assert_se(parse_extension_release(tempdir, IMAGE_CONFEXT, "tester", false, "ID", &id, "VERSION_ID", &version_id) == 0);
log_info("ID: %s VERSION_ID: %s", id, version_id);
assert_se(streq(id, "the-id"));
assert_se(streq(version_id, "the-version-id"));
- assert_se(parse_extension_release(tempdir, IMAGE_CONFEXT, false, "tester", "FOOBAR", &foobar) == 0);
+ assert_se(parse_extension_release(tempdir, IMAGE_CONFEXT, "tester", false, "FOOBAR", &foobar) == 0);
log_info("FOOBAR: %s", strnull(foobar));
assert_se(foobar == NULL);
- assert_se(parse_extension_release(tempdir, IMAGE_SYSEXT, false, "test", "FOOBAR", &foobar) == 0);
+ assert_se(parse_extension_release(tempdir, IMAGE_SYSEXT, "test", false, "FOOBAR", &foobar) == 0);
log_info("FOOBAR: %s", strnull(foobar));
assert_se(foobar == NULL);
}