tree-wide: use _cleanup_set_free_ and friends
Instead of _cleanup_(set_freep) or so.
This commit is contained in:
@@ -81,7 +81,7 @@ static void assert_equal_fd(int fd1, int fd2) {
|
||||
|
||||
TEST(copy_data_fd) {
|
||||
_cleanup_close_ int fd1 = -EBADF, fd2 = -EBADF;
|
||||
_cleanup_(close_pairp) int sfd[2] = PIPE_EBADF;
|
||||
_cleanup_close_pair_ int sfd[2] = PIPE_EBADF;
|
||||
_cleanup_(sigkill_waitp) pid_t pid = -1;
|
||||
int r;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "tests.h"
|
||||
|
||||
TEST(hashmap_replace) {
|
||||
_cleanup_(hashmap_freep) Hashmap *m = NULL;
|
||||
_cleanup_hashmap_free_ Hashmap *m = NULL;
|
||||
_cleanup_free_ char *val1 = NULL, *val2 = NULL, *val3 = NULL, *val4 = NULL, *val5 = NULL;
|
||||
char *r;
|
||||
|
||||
@@ -43,8 +43,8 @@ TEST(hashmap_replace) {
|
||||
}
|
||||
|
||||
TEST(hashmap_copy) {
|
||||
_cleanup_(hashmap_freep) Hashmap *m = NULL;
|
||||
_cleanup_(hashmap_free_freep) Hashmap *copy = NULL;
|
||||
_cleanup_hashmap_free_ Hashmap *m = NULL;
|
||||
_cleanup_hashmap_free_free_ Hashmap *copy = NULL;
|
||||
char *val1, *val2, *val3, *val4, *r;
|
||||
|
||||
val1 = strdup("val1");
|
||||
@@ -76,8 +76,8 @@ TEST(hashmap_copy) {
|
||||
}
|
||||
|
||||
TEST(hashmap_get_strv) {
|
||||
_cleanup_(hashmap_freep) Hashmap *m = NULL;
|
||||
_cleanup_(strv_freep) char **strv = NULL;
|
||||
_cleanup_hashmap_free_ Hashmap *m = NULL;
|
||||
_cleanup_strv_free_ char **strv = NULL;
|
||||
char *val1, *val2, *val3, *val4;
|
||||
|
||||
val1 = strdup("val1");
|
||||
@@ -109,7 +109,7 @@ TEST(hashmap_get_strv) {
|
||||
}
|
||||
|
||||
TEST(hashmap_move_one) {
|
||||
_cleanup_(hashmap_free_freep) Hashmap *m = NULL, *n = NULL;
|
||||
_cleanup_hashmap_free_free_ Hashmap *m = NULL, *n = NULL;
|
||||
char *val1, *val2, *val3, *val4, *r;
|
||||
|
||||
val1 = strdup("val1");
|
||||
@@ -145,7 +145,7 @@ TEST(hashmap_move_one) {
|
||||
}
|
||||
|
||||
TEST(hashmap_move) {
|
||||
_cleanup_(hashmap_free_freep) Hashmap *m = NULL, *n = NULL;
|
||||
_cleanup_hashmap_free_free_ Hashmap *m = NULL, *n = NULL;
|
||||
char *val1, *val2, *val3, *val4, *r;
|
||||
|
||||
val1 = strdup("val1");
|
||||
@@ -184,7 +184,7 @@ TEST(hashmap_move) {
|
||||
}
|
||||
|
||||
TEST(hashmap_update) {
|
||||
_cleanup_(hashmap_freep) Hashmap *m = NULL;
|
||||
_cleanup_hashmap_free_ Hashmap *m = NULL;
|
||||
_cleanup_free_ char *val1 = NULL, *val2 = NULL;
|
||||
char *r;
|
||||
|
||||
@@ -208,7 +208,7 @@ TEST(hashmap_update) {
|
||||
}
|
||||
|
||||
TEST(hashmap_put) {
|
||||
_cleanup_(hashmap_freep) Hashmap *m = NULL;
|
||||
_cleanup_hashmap_free_ Hashmap *m = NULL;
|
||||
int valid_hashmap_put;
|
||||
void *val1 = (void*) "val 1";
|
||||
void *val2 = (void*) "val 2";
|
||||
@@ -417,7 +417,7 @@ TEST(hashmap_ensure_allocated) {
|
||||
}
|
||||
|
||||
TEST(hashmap_foreach_key) {
|
||||
_cleanup_(hashmap_freep) Hashmap *m = NULL;
|
||||
_cleanup_hashmap_free_ Hashmap *m = NULL;
|
||||
bool key_found[] = { false, false, false, false };
|
||||
const char *s;
|
||||
const char *key;
|
||||
@@ -449,7 +449,7 @@ TEST(hashmap_foreach_key) {
|
||||
}
|
||||
|
||||
TEST(hashmap_foreach) {
|
||||
_cleanup_(hashmap_free_freep) Hashmap *m = NULL;
|
||||
_cleanup_hashmap_free_free_ Hashmap *m = NULL;
|
||||
bool value_found[] = { false, false, false, false };
|
||||
char *val1, *val2, *val3, *val4, *s;
|
||||
unsigned count;
|
||||
@@ -496,8 +496,8 @@ TEST(hashmap_foreach) {
|
||||
}
|
||||
|
||||
TEST(hashmap_merge) {
|
||||
_cleanup_(hashmap_free_freep) Hashmap *m = NULL;
|
||||
_cleanup_(hashmap_freep) Hashmap *n = NULL;
|
||||
_cleanup_hashmap_free_free_ Hashmap *m = NULL;
|
||||
_cleanup_hashmap_free_ Hashmap *n = NULL;
|
||||
char *val1, *val2, *val3, *val4, *r;
|
||||
|
||||
val1 = strdup("my val1");
|
||||
@@ -528,7 +528,7 @@ TEST(hashmap_merge) {
|
||||
}
|
||||
|
||||
TEST(hashmap_contains) {
|
||||
_cleanup_(hashmap_free_freep) Hashmap *m = NULL;
|
||||
_cleanup_hashmap_free_free_ Hashmap *m = NULL;
|
||||
char *val1;
|
||||
|
||||
val1 = strdup("my val");
|
||||
@@ -547,7 +547,7 @@ TEST(hashmap_contains) {
|
||||
}
|
||||
|
||||
TEST(hashmap_isempty) {
|
||||
_cleanup_(hashmap_free_freep) Hashmap *m = NULL;
|
||||
_cleanup_hashmap_free_free_ Hashmap *m = NULL;
|
||||
char *val1;
|
||||
|
||||
val1 = strdup("my val");
|
||||
@@ -563,7 +563,7 @@ TEST(hashmap_isempty) {
|
||||
}
|
||||
|
||||
TEST(hashmap_size) {
|
||||
_cleanup_(hashmap_free_freep) Hashmap *m = NULL;
|
||||
_cleanup_hashmap_free_free_ Hashmap *m = NULL;
|
||||
char *val1, *val2, *val3, *val4;
|
||||
|
||||
val1 = strdup("my val");
|
||||
@@ -591,7 +591,7 @@ TEST(hashmap_size) {
|
||||
}
|
||||
|
||||
TEST(hashmap_get) {
|
||||
_cleanup_(hashmap_free_freep) Hashmap *m = NULL;
|
||||
_cleanup_hashmap_free_free_ Hashmap *m = NULL;
|
||||
char *r;
|
||||
char *val;
|
||||
|
||||
|
||||
@@ -578,7 +578,7 @@ TEST(preset_and_list) {
|
||||
UnitFileState state;
|
||||
bool got_yes = false, got_no = false;
|
||||
UnitFileList *fl;
|
||||
_cleanup_(hashmap_freep) Hashmap *h = NULL;
|
||||
_cleanup_hashmap_free_ Hashmap *h = NULL;
|
||||
|
||||
CLEANUP_ARRAY(changes, n_changes, install_changes_free);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ static void dump_changes(InstallChange *c, unsigned n) {
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
_cleanup_(hashmap_freep) Hashmap *h = NULL;
|
||||
_cleanup_hashmap_free_ Hashmap *h = NULL;
|
||||
UnitFileList *p;
|
||||
int r;
|
||||
const char *const files[] = { "avahi-daemon.service", NULL };
|
||||
|
||||
@@ -41,7 +41,7 @@ STATIC_DESTRUCTOR_REGISTER(runtime_dir, rm_rf_physical_and_freep);
|
||||
|
||||
TEST_RET(unit_file_get_set) {
|
||||
int r;
|
||||
_cleanup_(hashmap_freep) Hashmap *h = NULL;
|
||||
_cleanup_hashmap_free_ Hashmap *h = NULL;
|
||||
UnitFileList *p;
|
||||
|
||||
h = hashmap_new(&unit_file_list_hash_ops_free);
|
||||
|
||||
@@ -143,7 +143,7 @@ static int run(int argc, char *argv[]) {
|
||||
sd_id128_t id;
|
||||
#endif
|
||||
_cleanup_free_ char *p = NULL, *cmd = NULL;
|
||||
_cleanup_(pclosep) FILE *sfdisk = NULL;
|
||||
_cleanup_pclose_ FILE *sfdisk = NULL;
|
||||
_cleanup_(loop_device_unrefp) LoopDevice *loop = NULL;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
int r;
|
||||
|
||||
+2
-2
@@ -145,8 +145,8 @@ TEST(set_ensure_allocated) {
|
||||
}
|
||||
|
||||
TEST(set_copy) {
|
||||
_cleanup_(set_freep) Set *s = NULL;
|
||||
_cleanup_(set_free_freep) Set *copy = NULL;
|
||||
_cleanup_set_free_ Set *s = NULL;
|
||||
_cleanup_set_free_free_ Set *copy = NULL;
|
||||
char *key1, *key2, *key3, *key4;
|
||||
|
||||
key1 = strdup("key1");
|
||||
|
||||
@@ -260,7 +260,7 @@ TEST(invalid_unquote) {
|
||||
}
|
||||
|
||||
TEST(strv_split) {
|
||||
_cleanup_(strv_free_erasep) char **l = NULL;
|
||||
_cleanup_strv_free_erase_ char **l = NULL;
|
||||
const char str[] = "one,two,three";
|
||||
|
||||
l = strv_split(str, ",");
|
||||
|
||||
@@ -272,7 +272,7 @@ int main(int argc, char *argv[]) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *tmpdir = NULL;
|
||||
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
|
||||
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
|
||||
_cleanup_(close_pairp) int block_fds[2] = PIPE_EBADF;
|
||||
_cleanup_close_pair_ int block_fds[2] = PIPE_EBADF;
|
||||
pthread_t t;
|
||||
const char *sp;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user