summaryrefslogtreecommitdiffstats
path: root/src/libsystemd
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-11-30 17:38:56 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-12-02 05:35:34 +0100
commit5dd9527883e0aa8705cf81448bc4bdb0456382fb (patch)
treed7fd0f72f0687bfbd10dfac80f5f5a6f78e111c9 /src/libsystemd
parentMerge pull request #11013 from evverx/travis-clang (diff)
downloadsystemd-5dd9527883e0aa8705cf81448bc4bdb0456382fb.tar.xz
systemd-5dd9527883e0aa8705cf81448bc4bdb0456382fb.zip
tree-wide: remove various unused functions
All found with "cppcheck --enable=unusedFunction".
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-bus/bus-internal.c20
-rw-r--r--src/libsystemd/sd-bus/bus-internal.h5
-rw-r--r--src/libsystemd/sd-bus/bus-match.c102
-rw-r--r--src/libsystemd/sd-bus/bus-match.h2
-rw-r--r--src/libsystemd/sd-bus/bus-message.c10
-rw-r--r--src/libsystemd/sd-bus/bus-message.h2
-rw-r--r--src/libsystemd/sd-bus/bus-type.c26
-rw-r--r--src/libsystemd/sd-bus/bus-type.h1
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c19
9 files changed, 0 insertions, 187 deletions
diff --git a/src/libsystemd/sd-bus/bus-internal.c b/src/libsystemd/sd-bus/bus-internal.c
index 1310cf91e5..40acae2133 100644
--- a/src/libsystemd/sd-bus/bus-internal.c
+++ b/src/libsystemd/sd-bus/bus-internal.c
@@ -151,26 +151,6 @@ bool service_name_is_valid(const char *p) {
return true;
}
-char* service_name_startswith(const char *a, const char *b) {
- const char *p;
-
- if (!service_name_is_valid(a) ||
- !service_name_is_valid(b))
- return NULL;
-
- p = startswith(a, b);
- if (!p)
- return NULL;
-
- if (*p == 0)
- return (char*) p;
-
- if (*p == '.')
- return (char*) p + 1;
-
- return NULL;
-}
-
bool member_name_is_valid(const char *p) {
const char *q;
diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h
index 4bc945d9ee..b352f0bfe5 100644
--- a/src/libsystemd/sd-bus/bus-internal.h
+++ b/src/libsystemd/sd-bus/bus-internal.h
@@ -305,8 +305,6 @@ struct sd_bus {
sd_bus **default_bus_ptr;
pid_t tid;
- char *cgroup_root;
-
char *description;
char *patch_sender;
@@ -346,7 +344,6 @@ struct sd_bus {
bool interface_name_is_valid(const char *p) _pure_;
bool service_name_is_valid(const char *p) _pure_;
-char* service_name_startswith(const char *a, const char *b);
bool member_name_is_valid(const char *p) _pure_;
bool object_path_is_valid(const char *p) _pure_;
char *object_path_startswith(const char *a, const char *b) _pure_;
@@ -397,8 +394,6 @@ int bus_set_address_user(sd_bus *bus);
int bus_set_address_system_remote(sd_bus *b, const char *host);
int bus_set_address_system_machine(sd_bus *b, const char *machine);
-int bus_get_root_path(sd_bus *bus);
-
int bus_maybe_reply_error(sd_bus_message *m, int r, sd_bus_error *error);
#define bus_assert_return(expr, r, error) \
diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c
index 37b851b94c..6812c28904 100644
--- a/src/libsystemd/sd-bus/bus-match.c
+++ b/src/libsystemd/sd-bus/bus-match.c
@@ -542,43 +542,6 @@ fail:
return r;
}
-static int bus_match_find_compare_value(
- struct bus_match_node *where,
- enum bus_match_node_type t,
- uint8_t value_u8,
- const char *value_str,
- struct bus_match_node **ret) {
-
- struct bus_match_node *c, *n;
-
- assert(where);
- assert(IN_SET(where->type, BUS_MATCH_ROOT, BUS_MATCH_VALUE));
- assert(BUS_MATCH_IS_COMPARE(t));
- assert(ret);
-
- for (c = where->child; c && c->type != t; c = c->next)
- ;
-
- if (!c)
- return 0;
-
- if (t == BUS_MATCH_MESSAGE_TYPE)
- n = hashmap_get(c->compare.children, UINT_TO_PTR(value_u8));
- else if (BUS_MATCH_CAN_HASH(t))
- n = hashmap_get(c->compare.children, value_str);
- else {
- for (n = c->child; n && !value_node_same(n, t, value_u8, value_str); n = n->next)
- ;
- }
-
- if (n) {
- *ret = n;
- return 1;
- }
-
- return 0;
-}
-
static int bus_match_add_leaf(
struct bus_match_node *where,
struct match_callback *callback) {
@@ -607,34 +570,6 @@ static int bus_match_add_leaf(
return 1;
}
-static int bus_match_find_leaf(
- struct bus_match_node *where,
- sd_bus_message_handler_t callback,
- void *userdata,
- struct bus_match_node **ret) {
-
- struct bus_match_node *c;
-
- assert(where);
- assert(IN_SET(where->type, BUS_MATCH_ROOT, BUS_MATCH_VALUE));
- assert(ret);
-
- for (c = where->child; c; c = c->next) {
- sd_bus_slot *s;
-
- s = container_of(c->leaf.callback, sd_bus_slot, match_callback);
-
- if (c->type == BUS_MATCH_LEAF &&
- c->leaf.callback->callback == callback &&
- s->userdata == userdata) {
- *ret = c;
- return 1;
- }
- }
-
- return 0;
-}
-
enum bus_match_node_type bus_match_node_type_from_string(const char *k, size_t n) {
assert(k);
@@ -1014,43 +949,6 @@ int bus_match_remove(
return 1;
}
-int bus_match_find(
- struct bus_match_node *root,
- struct bus_match_component *components,
- unsigned n_components,
- sd_bus_message_handler_t callback,
- void *userdata,
- struct match_callback **ret) {
-
- struct bus_match_node *n, **gc;
- unsigned i;
- int r;
-
- assert(root);
- assert(ret);
-
- gc = newa(struct bus_match_node*, n_components);
-
- n = root;
- for (i = 0; i < n_components; i++) {
- r = bus_match_find_compare_value(
- n, components[i].type,
- components[i].value_u8, components[i].value_str,
- &n);
- if (r <= 0)
- return r;
-
- gc[i] = n;
- }
-
- r = bus_match_find_leaf(n, callback, userdata, &n);
- if (r <= 0)
- return r;
-
- *ret = n->leaf.callback;
- return 1;
-}
-
void bus_match_free(struct bus_match_node *node) {
struct bus_match_node *c;
diff --git a/src/libsystemd/sd-bus/bus-match.h b/src/libsystemd/sd-bus/bus-match.h
index b9c0fcec90..a6f67ce089 100644
--- a/src/libsystemd/sd-bus/bus-match.h
+++ b/src/libsystemd/sd-bus/bus-match.h
@@ -66,8 +66,6 @@ int bus_match_run(sd_bus *bus, struct bus_match_node *root, sd_bus_message *m);
int bus_match_add(struct bus_match_node *root, struct bus_match_component *components, unsigned n_components, struct match_callback *callback);
int bus_match_remove(struct bus_match_node *root, struct match_callback *callback);
-int bus_match_find(struct bus_match_node *root, struct bus_match_component *components, unsigned n_components, sd_bus_message_handler_t callback, void *userdata, struct match_callback **ret);
-
void bus_match_free(struct bus_match_node *node);
void bus_match_dump(struct bus_match_node *node, unsigned level);
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index f25db35998..bb7e09c945 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -5829,16 +5829,6 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) {
return 0;
}
-int bus_message_append_sender(sd_bus_message *m, const char *sender) {
- assert(m);
- assert(sender);
-
- assert_return(!m->sealed, -EPERM);
- assert_return(!m->sender, -EPERM);
-
- return message_append_field_string(m, BUS_MESSAGE_HEADER_SENDER, SD_BUS_TYPE_STRING, sender, &m->sender);
-}
-
_public_ int sd_bus_message_get_priority(sd_bus_message *m, int64_t *priority) {
assert_return(m, -EINVAL);
assert_return(priority, -EINVAL);
diff --git a/src/libsystemd/sd-bus/bus-message.h b/src/libsystemd/sd-bus/bus-message.h
index ef6ddc1cc0..0115437d26 100644
--- a/src/libsystemd/sd-bus/bus-message.h
+++ b/src/libsystemd/sd-bus/bus-message.h
@@ -209,7 +209,5 @@ int bus_message_new_synthetic_error(sd_bus *bus, uint64_t serial, const sd_bus_e
int bus_message_remarshal(sd_bus *bus, sd_bus_message **m);
-int bus_message_append_sender(sd_bus_message *m, const char *sender);
-
void bus_message_set_sender_driver(sd_bus *bus, sd_bus_message *m);
void bus_message_set_sender_local(sd_bus *bus, sd_bus_message *m);
diff --git a/src/libsystemd/sd-bus/bus-type.c b/src/libsystemd/sd-bus/bus-type.c
index 63eed99d28..18564a5383 100644
--- a/src/libsystemd/sd-bus/bus-type.c
+++ b/src/libsystemd/sd-bus/bus-type.c
@@ -30,32 +30,6 @@ bool bus_type_is_valid(char c) {
return !!memchr(valid, c, sizeof(valid));
}
-bool bus_type_is_valid_in_signature(char c) {
- static const char valid[] = {
- SD_BUS_TYPE_BYTE,
- SD_BUS_TYPE_BOOLEAN,
- SD_BUS_TYPE_INT16,
- SD_BUS_TYPE_UINT16,
- SD_BUS_TYPE_INT32,
- SD_BUS_TYPE_UINT32,
- SD_BUS_TYPE_INT64,
- SD_BUS_TYPE_UINT64,
- SD_BUS_TYPE_DOUBLE,
- SD_BUS_TYPE_STRING,
- SD_BUS_TYPE_OBJECT_PATH,
- SD_BUS_TYPE_SIGNATURE,
- SD_BUS_TYPE_ARRAY,
- SD_BUS_TYPE_VARIANT,
- SD_BUS_TYPE_STRUCT_BEGIN,
- SD_BUS_TYPE_STRUCT_END,
- SD_BUS_TYPE_DICT_ENTRY_BEGIN,
- SD_BUS_TYPE_DICT_ENTRY_END,
- SD_BUS_TYPE_UNIX_FD
- };
-
- return !!memchr(valid, c, sizeof(valid));
-}
-
bool bus_type_is_basic(char c) {
static const char valid[] = {
SD_BUS_TYPE_BYTE,
diff --git a/src/libsystemd/sd-bus/bus-type.h b/src/libsystemd/sd-bus/bus-type.h
index b518461b16..0ecd8513fd 100644
--- a/src/libsystemd/sd-bus/bus-type.h
+++ b/src/libsystemd/sd-bus/bus-type.h
@@ -6,7 +6,6 @@
#include "macro.h"
bool bus_type_is_valid(char c) _const_;
-bool bus_type_is_valid_in_signature(char c) _const_;
bool bus_type_is_basic(char c) _const_;
/* "trivial" is systemd's term for what the D-Bus Specification calls
* a "fixed type": that is, a basic type of fixed length */
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index f086d13898..3b00bc8157 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -194,7 +194,6 @@ static sd_bus* bus_free(sd_bus *b) {
free(b->auth_buffer);
free(b->address);
free(b->machine);
- free(b->cgroup_root);
free(b->description);
free(b->patch_sender);
@@ -3929,24 +3928,6 @@ _public_ int sd_bus_get_description(sd_bus *bus, const char **description) {
return 0;
}
-int bus_get_root_path(sd_bus *bus) {
- int r;
-
- if (bus->cgroup_root)
- return 0;
-
- r = cg_get_root_path(&bus->cgroup_root);
- if (r == -ENOENT) {
- bus->cgroup_root = strdup("/");
- if (!bus->cgroup_root)
- return -ENOMEM;
-
- r = 0;
- }
-
- return r;
-}
-
_public_ int sd_bus_get_scope(sd_bus *bus, const char **scope) {
assert_return(bus, -EINVAL);
assert_return(bus = bus_resolve(bus), -ENOPKG);