X Tutup
Skip to content

Commit 5dd9527

Browse files
poetteringyuwata
authored andcommitted
tree-wide: remove various unused functions
All found with "cppcheck --enable=unusedFunction".
1 parent c26ae30 commit 5dd9527

23 files changed

+0
-391
lines changed

src/boot/efi/shim.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -205,35 +205,3 @@ EFI_STATUS security_policy_install(void) {
205205

206206
return EFI_SUCCESS;
207207
}
208-
209-
EFI_STATUS security_policy_uninstall(void) {
210-
EFI_STATUS status;
211-
212-
if (esfas) {
213-
EFI_SECURITY_PROTOCOL *security_protocol;
214-
215-
status = uefi_call_wrapper(BS->LocateProtocol, 3, (EFI_GUID*) &security_protocol_guid, NULL, (VOID**) &security_protocol);
216-
217-
if (status != EFI_SUCCESS)
218-
return status;
219-
220-
security_protocol->FileAuthenticationState = esfas;
221-
esfas = NULL;
222-
} else
223-
/* nothing installed */
224-
return EFI_NOT_STARTED;
225-
226-
if (es2fa) {
227-
EFI_SECURITY2_PROTOCOL *security2_protocol;
228-
229-
status = uefi_call_wrapper(BS->LocateProtocol, 3, (EFI_GUID*) &security2_protocol_guid, NULL, (VOID**) &security2_protocol);
230-
231-
if (status != EFI_SUCCESS)
232-
return status;
233-
234-
security2_protocol->FileAuthentication = es2fa;
235-
es2fa = NULL;
236-
}
237-
238-
return EFI_SUCCESS;
239-
}

src/boot/efi/shim.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,3 @@ BOOLEAN shim_loaded(void);
1414
BOOLEAN secure_boot_enabled(void);
1515

1616
EFI_STATUS security_policy_install(void);
17-
18-
EFI_STATUS security_policy_uninstall(void);

src/core/unit-printf.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -286,35 +286,3 @@ int unit_full_printf(Unit *u, const char *format, char **ret) {
286286

287287
return specifier_printf(format, table, u, ret);
288288
}
289-
290-
int unit_full_printf_strv(Unit *u, char **l, char ***ret) {
291-
size_t n;
292-
char **r, **i, **j;
293-
int q;
294-
295-
/* Applies unit_full_printf to every entry in l */
296-
297-
assert(u);
298-
299-
n = strv_length(l);
300-
r = new(char*, n+1);
301-
if (!r)
302-
return -ENOMEM;
303-
304-
for (i = l, j = r; *i; i++, j++) {
305-
q = unit_full_printf(u, *i, j);
306-
if (q < 0)
307-
goto fail;
308-
}
309-
310-
*j = NULL;
311-
*ret = r;
312-
return 0;
313-
314-
fail:
315-
for (j--; j >= r; j--)
316-
free(*j);
317-
318-
free(r);
319-
return q;
320-
}

src/core/unit-printf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55

66
int unit_name_printf(Unit *u, const char* text, char **ret);
77
int unit_full_printf(Unit *u, const char *text, char **ret);
8-
int unit_full_printf_strv(Unit *u, char **l, char ***ret);

src/libsystemd/sd-bus/bus-internal.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -151,26 +151,6 @@ bool service_name_is_valid(const char *p) {
151151
return true;
152152
}
153153

154-
char* service_name_startswith(const char *a, const char *b) {
155-
const char *p;
156-
157-
if (!service_name_is_valid(a) ||
158-
!service_name_is_valid(b))
159-
return NULL;
160-
161-
p = startswith(a, b);
162-
if (!p)
163-
return NULL;
164-
165-
if (*p == 0)
166-
return (char*) p;
167-
168-
if (*p == '.')
169-
return (char*) p + 1;
170-
171-
return NULL;
172-
}
173-
174154
bool member_name_is_valid(const char *p) {
175155
const char *q;
176156

src/libsystemd/sd-bus/bus-internal.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,6 @@ struct sd_bus {
305305
sd_bus **default_bus_ptr;
306306
pid_t tid;
307307

308-
char *cgroup_root;
309-
310308
char *description;
311309
char *patch_sender;
312310

@@ -346,7 +344,6 @@ struct sd_bus {
346344

347345
bool interface_name_is_valid(const char *p) _pure_;
348346
bool service_name_is_valid(const char *p) _pure_;
349-
char* service_name_startswith(const char *a, const char *b);
350347
bool member_name_is_valid(const char *p) _pure_;
351348
bool object_path_is_valid(const char *p) _pure_;
352349
char *object_path_startswith(const char *a, const char *b) _pure_;
@@ -397,8 +394,6 @@ int bus_set_address_user(sd_bus *bus);
397394
int bus_set_address_system_remote(sd_bus *b, const char *host);
398395
int bus_set_address_system_machine(sd_bus *b, const char *machine);
399396

400-
int bus_get_root_path(sd_bus *bus);
401-
402397
int bus_maybe_reply_error(sd_bus_message *m, int r, sd_bus_error *error);
403398

404399
#define bus_assert_return(expr, r, error) \

src/libsystemd/sd-bus/bus-match.c

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -542,43 +542,6 @@ static int bus_match_add_compare_value(
542542
return r;
543543
}
544544

545-
static int bus_match_find_compare_value(
546-
struct bus_match_node *where,
547-
enum bus_match_node_type t,
548-
uint8_t value_u8,
549-
const char *value_str,
550-
struct bus_match_node **ret) {
551-
552-
struct bus_match_node *c, *n;
553-
554-
assert(where);
555-
assert(IN_SET(where->type, BUS_MATCH_ROOT, BUS_MATCH_VALUE));
556-
assert(BUS_MATCH_IS_COMPARE(t));
557-
assert(ret);
558-
559-
for (c = where->child; c && c->type != t; c = c->next)
560-
;
561-
562-
if (!c)
563-
return 0;
564-
565-
if (t == BUS_MATCH_MESSAGE_TYPE)
566-
n = hashmap_get(c->compare.children, UINT_TO_PTR(value_u8));
567-
else if (BUS_MATCH_CAN_HASH(t))
568-
n = hashmap_get(c->compare.children, value_str);
569-
else {
570-
for (n = c->child; n && !value_node_same(n, t, value_u8, value_str); n = n->next)
571-
;
572-
}
573-
574-
if (n) {
575-
*ret = n;
576-
return 1;
577-
}
578-
579-
return 0;
580-
}
581-
582545
static int bus_match_add_leaf(
583546
struct bus_match_node *where,
584547
struct match_callback *callback) {
@@ -607,34 +570,6 @@ static int bus_match_add_leaf(
607570
return 1;
608571
}
609572

610-
static int bus_match_find_leaf(
611-
struct bus_match_node *where,
612-
sd_bus_message_handler_t callback,
613-
void *userdata,
614-
struct bus_match_node **ret) {
615-
616-
struct bus_match_node *c;
617-
618-
assert(where);
619-
assert(IN_SET(where->type, BUS_MATCH_ROOT, BUS_MATCH_VALUE));
620-
assert(ret);
621-
622-
for (c = where->child; c; c = c->next) {
623-
sd_bus_slot *s;
624-
625-
s = container_of(c->leaf.callback, sd_bus_slot, match_callback);
626-
627-
if (c->type == BUS_MATCH_LEAF &&
628-
c->leaf.callback->callback == callback &&
629-
s->userdata == userdata) {
630-
*ret = c;
631-
return 1;
632-
}
633-
}
634-
635-
return 0;
636-
}
637-
638573
enum bus_match_node_type bus_match_node_type_from_string(const char *k, size_t n) {
639574
assert(k);
640575

@@ -1014,43 +949,6 @@ int bus_match_remove(
1014949
return 1;
1015950
}
1016951

1017-
int bus_match_find(
1018-
struct bus_match_node *root,
1019-
struct bus_match_component *components,
1020-
unsigned n_components,
1021-
sd_bus_message_handler_t callback,
1022-
void *userdata,
1023-
struct match_callback **ret) {
1024-
1025-
struct bus_match_node *n, **gc;
1026-
unsigned i;
1027-
int r;
1028-
1029-
assert(root);
1030-
assert(ret);
1031-
1032-
gc = newa(struct bus_match_node*, n_components);
1033-
1034-
n = root;
1035-
for (i = 0; i < n_components; i++) {
1036-
r = bus_match_find_compare_value(
1037-
n, components[i].type,
1038-
components[i].value_u8, components[i].value_str,
1039-
&n);
1040-
if (r <= 0)
1041-
return r;
1042-
1043-
gc[i] = n;
1044-
}
1045-
1046-
r = bus_match_find_leaf(n, callback, userdata, &n);
1047-
if (r <= 0)
1048-
return r;
1049-
1050-
*ret = n->leaf.callback;
1051-
return 1;
1052-
}
1053-
1054952
void bus_match_free(struct bus_match_node *node) {
1055953
struct bus_match_node *c;
1056954

src/libsystemd/sd-bus/bus-match.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ int bus_match_run(sd_bus *bus, struct bus_match_node *root, sd_bus_message *m);
6666
int bus_match_add(struct bus_match_node *root, struct bus_match_component *components, unsigned n_components, struct match_callback *callback);
6767
int bus_match_remove(struct bus_match_node *root, struct match_callback *callback);
6868

69-
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);
70-
7169
void bus_match_free(struct bus_match_node *node);
7270

7371
void bus_match_dump(struct bus_match_node *node, unsigned level);

src/libsystemd/sd-bus/bus-message.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5829,16 +5829,6 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) {
58295829
return 0;
58305830
}
58315831

5832-
int bus_message_append_sender(sd_bus_message *m, const char *sender) {
5833-
assert(m);
5834-
assert(sender);
5835-
5836-
assert_return(!m->sealed, -EPERM);
5837-
assert_return(!m->sender, -EPERM);
5838-
5839-
return message_append_field_string(m, BUS_MESSAGE_HEADER_SENDER, SD_BUS_TYPE_STRING, sender, &m->sender);
5840-
}
5841-
58425832
_public_ int sd_bus_message_get_priority(sd_bus_message *m, int64_t *priority) {
58435833
assert_return(m, -EINVAL);
58445834
assert_return(priority, -EINVAL);

src/libsystemd/sd-bus/bus-message.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,5 @@ int bus_message_new_synthetic_error(sd_bus *bus, uint64_t serial, const sd_bus_e
209209

210210
int bus_message_remarshal(sd_bus *bus, sd_bus_message **m);
211211

212-
int bus_message_append_sender(sd_bus_message *m, const char *sender);
213-
214212
void bus_message_set_sender_driver(sd_bus *bus, sd_bus_message *m);
215213
void bus_message_set_sender_local(sd_bus *bus, sd_bus_message *m);

0 commit comments

Comments
 (0)
X Tutup