]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cap-list: rename capability_set_to_string_alloc() → capability_set_to_string()
authorLennart Poettering <lennart@poettering.net>
Mon, 20 Feb 2023 10:33:48 +0000 (11:33 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 20 Feb 2023 15:13:49 +0000 (16:13 +0100)
We typically don't use the _alloc() suffix anymore for anything, hence
drop it here too.

src/basic/cap-list.c
src/basic/cap-list.h
src/core/dbus-execute.c
src/core/execute.c
src/shared/bus-print-properties.c
src/test/test-cap-list.c

index fb1ad14fd3b50eb91c66bcbd82022f344290d523..b764d23cca1cc088e40dec785acb7a131163fdc0 100644 (file)
@@ -56,11 +56,11 @@ int capability_list_length(void) {
         return (int) ELEMENTSOF(capability_names);
 }
 
-int capability_set_to_string_alloc(uint64_t set, char **s) {
+int capability_set_to_string(uint64_t set, char **ret) {
         _cleanup_free_ char *str = NULL;
         size_t n = 0;
 
-        assert(s);
+        assert(ret);
 
         for (unsigned i = 0; i <= cap_last_cap(); i++)
                 if (set & (UINT64_C(1) << i)) {
@@ -88,8 +88,7 @@ int capability_set_to_string_alloc(uint64_t set, char **s) {
 
         str[n > 0 ? n - 1 : 0] = '\0'; /* truncate the last space, if it's there */
 
-        *s = TAKE_PTR(str);
-
+        *ret = TAKE_PTR(str);
         return 0;
 }
 
index 71235d6a285ce25b10a36a21a04d2ef628ea9b88..42d29c4718e4ffa3987a1ae07af6d32223d321ed 100644 (file)
@@ -7,5 +7,5 @@ const char *capability_to_name(int id);
 int capability_from_name(const char *name);
 int capability_list_length(void);
 
-int capability_set_to_string_alloc(uint64_t set, char **s);
+int capability_set_to_string(uint64_t set, char **ret);
 int capability_set_from_string(const char *s, uint64_t *set);
index f514b8fd129a982ec4881e4a9ed140a0fc420f5b..b07b5775ff4e5364834dd9d986b04e780edd5b8f 100644 (file)
@@ -1671,7 +1671,7 @@ static BUS_DEFINE_SET_TRANSIENT_PARSE(proc_subset, ProcSubset, proc_subset_from_
 static BUS_DEFINE_SET_TRANSIENT_PARSE(preserve_mode, ExecPreserveMode, exec_preserve_mode_from_string);
 static BUS_DEFINE_SET_TRANSIENT_PARSE_PTR(personality, unsigned long, parse_personality);
 static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(secure_bits, "i", int32_t, int, "%" PRIi32, secure_bits_to_string_alloc_with_check);
-static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(capability, "t", uint64_t, uint64_t, "%" PRIu64, capability_set_to_string_alloc);
+static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(capability, "t", uint64_t, uint64_t, "%" PRIu64, capability_set_to_string);
 static BUS_DEFINE_SET_TRANSIENT_TO_STRING_ALLOC(namespace_flag, "t", uint64_t, unsigned long, "%" PRIu64, namespace_flags_to_string);
 static BUS_DEFINE_SET_TRANSIENT_TO_STRING(mount_flags, "t", uint64_t, unsigned long, "%" PRIu64, mount_propagation_flag_to_string_with_check);
 
index 36d664c7ee96fe2698856231c3b525f8ef44343d..5116a73617ae2f8491e52509159cb31e9f0dcc33 100644 (file)
@@ -6195,7 +6195,7 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
         if (c->capability_bounding_set != CAP_ALL) {
                 _cleanup_free_ char *str = NULL;
 
-                r = capability_set_to_string_alloc(c->capability_bounding_set, &str);
+                r = capability_set_to_string(c->capability_bounding_set, &str);
                 if (r >= 0)
                         fprintf(f, "%sCapabilityBoundingSet: %s\n", prefix, str);
         }
@@ -6203,7 +6203,7 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
         if (c->capability_ambient_set != 0) {
                 _cleanup_free_ char *str = NULL;
 
-                r = capability_set_to_string_alloc(c->capability_ambient_set, &str);
+                r = capability_set_to_string(c->capability_ambient_set, &str);
                 if (r >= 0)
                         fprintf(f, "%sAmbientCapabilities: %s\n", prefix, str);
         }
index 9369866fa1a563a704067e4aec6b081bde918631..db41ad249579da84796f3ab616620fc2cf054128 100644 (file)
@@ -145,7 +145,7 @@ static int bus_print_property(const char *name, const char *expected_value, sd_b
                 } else if (STR_IN_SET(name, "CapabilityBoundingSet", "AmbientCapabilities")) {
                         _cleanup_free_ char *s = NULL;
 
-                        r = capability_set_to_string_alloc(u, &s);
+                        r = capability_set_to_string(u, &s);
                         if (r < 0)
                                 return r;
 
index 68f0461a6219a9d55618c381274346d7d13e7ca2..31c61b8d8d13e1009c1e11932b9fd6cee73b9852 100644 (file)
@@ -57,7 +57,7 @@ static void test_capability_set_one(uint64_t c, const char *t) {
         _cleanup_free_ char *t1 = NULL;
         uint64_t c1, c_masked = c & all_capabilities();
 
-        assert_se(capability_set_to_string_alloc(c, &t1) == 0);
+        assert_se(capability_set_to_string(c, &t1) == 0);
         assert_se(streq(t1, t));
 
         assert_se(capability_set_from_string(t1, &c1) == 0);