summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2013-04-18 09:11:22 +0200
committerHarald Hoyer <harald@redhat.com>2013-04-18 09:11:22 +0200
commit7fd1b19bc9e9f5574f2877936b8ac267c7706947 (patch)
treecac68de0832e4a61944e88390b649341519c43b2 /src/shared
parentd70964d0f61f1add3a71c83beb925fc1fa2fab6b (diff)
move _cleanup_ attribute in front of the type
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/cgroup-show.c4
-rw-r--r--src/shared/cgroup-util.c8
-rw-r--r--src/shared/conf-parser.c6
-rw-r--r--src/shared/dbus-loop.c6
-rw-r--r--src/shared/fileio.c4
-rw-r--r--src/shared/hwclock.c2
-rw-r--r--src/shared/install-printf.c2
-rw-r--r--src/shared/install.c88
-rw-r--r--src/shared/logs-show.c10
-rw-r--r--src/shared/path-lookup.c6
-rw-r--r--src/shared/socket-util.c4
-rw-r--r--src/shared/util.c4
-rw-r--r--src/shared/utmp-wtmp.c2
-rw-r--r--src/shared/virt.c2
14 files changed, 74 insertions, 74 deletions
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
index 0e82375ea9..83cc0731b8 100644
--- a/src/shared/cgroup-show.c
+++ b/src/shared/cgroup-show.c
@@ -237,7 +237,7 @@ int show_cgroup(const char *controller, const char *path, const char *prefix, un
}
static int show_extra_pids(const char *controller, const char *path, const char *prefix, unsigned n_columns, const pid_t pids[], unsigned n_pids, OutputFlags flags) {
- pid_t _cleanup_free_ *copy = NULL;
+ _cleanup_free_ pid_t *copy = NULL;
unsigned i, j;
int r;
@@ -257,7 +257,7 @@ static int show_extra_pids(const char *controller, const char *path, const char
return -ENOMEM;
for (i = 0, j = 0; i < n_pids; i++) {
- char _cleanup_free_ *k = NULL;
+ _cleanup_free_ char *k = NULL;
r = cg_pid_get_path(controller, pids[i], &k);
if (r < 0)
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index 0749b61154..5d44342bbe 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -1250,7 +1250,7 @@ int cg_path_get_unit(const char *path, char **unit) {
}
int cg_pid_get_unit(pid_t pid, char **unit) {
- char _cleanup_free_ *cgroup = NULL;
+ _cleanup_free_ char *cgroup = NULL;
int r;
assert(unit);
@@ -1306,7 +1306,7 @@ int cg_path_get_user_unit(const char *path, char **unit) {
}
int cg_pid_get_user_unit(pid_t pid, char **unit) {
- char _cleanup_free_ *cgroup = NULL;
+ _cleanup_free_ char *cgroup = NULL;
int r;
assert(unit);
@@ -1342,7 +1342,7 @@ int cg_path_get_machine_name(const char *path, char **machine) {
}
int cg_pid_get_machine_name(pid_t pid, char **machine) {
- char _cleanup_free_ *cgroup = NULL;
+ _cleanup_free_ char *cgroup = NULL;
int r;
assert(machine);
@@ -1386,7 +1386,7 @@ int cg_path_get_session(const char *path, char **session) {
}
int cg_pid_get_session(pid_t pid, char **session) {
- char _cleanup_free_ *cgroup = NULL;
+ _cleanup_free_ char *cgroup = NULL;
int r;
assert(session);
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 7a986623fb..3d14c58d13 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -219,7 +219,7 @@ static int parse_line(const char* unit,
return 0;
if (startswith(l, ".include ")) {
- char _cleanup_free_ *fn;
+ _cleanup_free_ char *fn;
fn = file_in_same_dir(filename, strstrip(l+9));
if (!fn)
@@ -302,8 +302,8 @@ int config_parse(const char *unit,
void *userdata) {
unsigned line = 0;
- char _cleanup_free_ *section = NULL, *continuation = NULL;
- FILE _cleanup_fclose_ *ours = NULL;
+ _cleanup_free_ char *section = NULL, *continuation = NULL;
+ _cleanup_fclose_ FILE *ours = NULL;
int r;
assert(filename);
diff --git a/src/shared/dbus-loop.c b/src/shared/dbus-loop.c
index fadbd43958..c533242220 100644
--- a/src/shared/dbus-loop.c
+++ b/src/shared/dbus-loop.c
@@ -44,7 +44,7 @@ typedef struct EpollData {
} EpollData;
static dbus_bool_t add_watch(DBusWatch *watch, void *data) {
- EpollData _cleanup_free_ *e = NULL;
+ _cleanup_free_ EpollData *e = NULL;
struct epoll_event ev = {};
assert(watch);
@@ -89,7 +89,7 @@ static dbus_bool_t add_watch(DBusWatch *watch, void *data) {
}
static void remove_watch(DBusWatch *watch, void *data) {
- EpollData _cleanup_free_ *e = NULL;
+ _cleanup_free_ EpollData *e = NULL;
assert(watch);
@@ -175,7 +175,7 @@ fail:
}
static void remove_timeout(DBusTimeout *timeout, void *data) {
- EpollData _cleanup_free_ *e = NULL;
+ _cleanup_free_ EpollData *e = NULL;
assert(timeout);
diff --git a/src/shared/fileio.c b/src/shared/fileio.c
index 4390726a93..2a272593a8 100644
--- a/src/shared/fileio.c
+++ b/src/shared/fileio.c
@@ -544,8 +544,8 @@ static void write_env_var(FILE *f, const char *v) {
int write_env_file(const char *fname, char **l) {
char **i;
- char _cleanup_free_ *p = NULL;
- FILE _cleanup_fclose_ *f = NULL;
+ _cleanup_free_ char *p = NULL;
+ _cleanup_fclose_ FILE *f = NULL;
int r;
r = fopen_temporary(fname, &f, &p);
diff --git a/src/shared/hwclock.c b/src/shared/hwclock.c
index 9076d8ffc7..a3b33ed4cc 100644
--- a/src/shared/hwclock.c
+++ b/src/shared/hwclock.c
@@ -163,7 +163,7 @@ int hwclock_set_time(const struct tm *tm) {
}
int hwclock_is_localtime(void) {
- FILE _cleanup_fclose_ *f;
+ _cleanup_fclose_ FILE *f;
/*
* The third line of adjtime is "UTC" or "LOCAL" or nothing.
diff --git a/src/shared/install-printf.c b/src/shared/install-printf.c
index 10b0cf379b..c44459b4e0 100644
--- a/src/shared/install-printf.c
+++ b/src/shared/install-printf.c
@@ -60,7 +60,7 @@ static char *specifier_instance(char specifier, void *data, void *userdata) {
static char *specifier_user_name(char specifier, void *data, void *userdata) {
InstallInfo *i = userdata;
const char *username;
- char _cleanup_free_ *tmp = NULL;
+ _cleanup_free_ char *tmp = NULL;
char *printed = NULL;
assert(i);
diff --git a/src/shared/install.c b/src/shared/install.c
index 75d6ca3619..959de04810 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -198,7 +198,7 @@ static int remove_marked_symlinks_fd(
char** files) {
int r = 0;
- DIR _cleanup_closedir_ *d = NULL;
+ _cleanup_closedir_ DIR *d = NULL;
assert(remove_symlinks_to);
assert(fd >= 0);
@@ -235,7 +235,7 @@ static int remove_marked_symlinks_fd(
if (de->d_type == DT_DIR) {
int nfd, q;
- char _cleanup_free_ *p = NULL;
+ _cleanup_free_ char *p = NULL;
nfd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW);
if (nfd < 0) {
@@ -260,7 +260,7 @@ static int remove_marked_symlinks_fd(
r = q;
} else if (de->d_type == DT_LNK) {
- char _cleanup_free_ *p = NULL, *dest = NULL;
+ _cleanup_free_ char *p = NULL, *dest = NULL;
int q;
bool found;
@@ -362,7 +362,7 @@ static int find_symlinks_fd(
bool *same_name_link) {
int r = 0;
- DIR _cleanup_closedir_ *d = NULL;
+ _cleanup_closedir_ DIR *d = NULL;
assert(name);
assert(fd >= 0);
@@ -395,7 +395,7 @@ static int find_symlinks_fd(
if (de->d_type == DT_DIR) {
int nfd, q;
- char _cleanup_free_ *p = NULL;
+ _cleanup_free_ char *p = NULL;
nfd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW);
if (nfd < 0) {
@@ -423,7 +423,7 @@ static int find_symlinks_fd(
r = q;
} else if (de->d_type == DT_LNK) {
- char _cleanup_free_ *p = NULL, *dest = NULL;
+ _cleanup_free_ char *p = NULL, *dest = NULL;
bool found_path, found_dest, b = false;
int q;
@@ -458,7 +458,7 @@ static int find_symlinks_fd(
found_dest = streq(path_get_file_name(dest), name);
if (found_path && found_dest) {
- char _cleanup_free_ *t = NULL;
+ _cleanup_free_ char *t = NULL;
/* Filter out same name links in the main
* config path */
@@ -508,7 +508,7 @@ static int find_symlinks_in_scope(
UnitFileState *state) {
int r;
- char _cleanup_free_ *path = NULL;
+ _cleanup_free_ char *path = NULL;
bool same_name_link_runtime = false, same_name_link = false;
assert(scope >= 0);
@@ -567,7 +567,7 @@ int unit_file_mask(
unsigned *n_changes) {
char **i;
- char _cleanup_free_ *prefix;
+ _cleanup_free_ char *prefix;
int r;
assert(scope >= 0);
@@ -578,7 +578,7 @@ int unit_file_mask(
return r;
STRV_FOREACH(i, files) {
- char _cleanup_free_ *path = NULL;
+ _cleanup_free_ char *path = NULL;
if (!unit_name_is_valid(*i, true)) {
if (r == 0)
@@ -700,9 +700,9 @@ int unit_file_link(
UnitFileChange **changes,
unsigned *n_changes) {
- LookupPaths _cleanup_lookup_paths_free_ paths = {};
+ _cleanup_lookup_paths_free_ LookupPaths paths = {};
char **i;
- char _cleanup_free_ *config_path = NULL;
+ _cleanup_free_ char *config_path = NULL;
int r, q;
assert(scope >= 0);
@@ -717,7 +717,7 @@ int unit_file_link(
return r;
STRV_FOREACH(i, files) {
- char _cleanup_free_ *path = NULL;
+ _cleanup_free_ char *path = NULL;
char *fn;
struct stat st;
@@ -758,7 +758,7 @@ int unit_file_link(
}
if (errno == EEXIST) {
- char _cleanup_free_ *dest = NULL;
+ _cleanup_free_ char *dest = NULL;
q = readlink_and_make_absolute(path, &dest);
@@ -941,7 +941,7 @@ static int config_parse_also(const char *unit,
assert(rvalue);
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
- char _cleanup_free_ *n;
+ _cleanup_free_ char *n;
int r;
n = strndup(w, l);
@@ -999,7 +999,7 @@ static int unit_file_load(
};
int fd;
- FILE _cleanup_fclose_ *f = NULL;
+ _cleanup_fclose_ FILE *f = NULL;
int r;
assert(c);
@@ -1117,7 +1117,7 @@ static int unit_file_can_install(
const char *name,
bool allow_symlink) {
- InstallContext _cleanup_install_context_done_ c = {};
+ _cleanup_install_context_done_ InstallContext c = {};
InstallInfo *i;
int r;
@@ -1148,7 +1148,7 @@ static int create_symlink(
UnitFileChange **changes,
unsigned *n_changes) {
- char _cleanup_free_ *dest = NULL;
+ _cleanup_free_ char *dest = NULL;
int r;
assert(old_path);
@@ -1199,7 +1199,7 @@ static int install_info_symlink_alias(
assert(config_path);
STRV_FOREACH(s, i->aliases) {
- char _cleanup_free_ *alias_path = NULL, *dst = NULL;
+ _cleanup_free_ char *alias_path = NULL, *dst = NULL;
dst = install_full_printf(i, *s);
if (!dst)
@@ -1231,7 +1231,7 @@ static int install_info_symlink_wants(
assert(config_path);
STRV_FOREACH(s, i->wanted_by) {
- char _cleanup_free_ *path = NULL, *dst = NULL;
+ _cleanup_free_ char *path = NULL, *dst = NULL;
dst = install_full_printf(i, *s);
if (!dst)
@@ -1268,7 +1268,7 @@ static int install_info_symlink_requires(
assert(config_path);
STRV_FOREACH(s, i->required_by) {
- char _cleanup_free_ *path = NULL, *dst = NULL;
+ _cleanup_free_ char *path = NULL, *dst = NULL;
dst = install_full_printf(i, *s);
if (!dst)
@@ -1300,7 +1300,7 @@ static int install_info_symlink_link(
unsigned *n_changes) {
int r;
- char _cleanup_free_ *path = NULL;
+ _cleanup_free_ char *path = NULL;
assert(i);
assert(paths);
@@ -1453,10 +1453,10 @@ int unit_file_enable(
UnitFileChange **changes,
unsigned *n_changes) {
- LookupPaths _cleanup_lookup_paths_free_ paths = {};
- InstallContext _cleanup_install_context_done_ c = {};
+ _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_install_context_done_ InstallContext c = {};
char **i;
- char _cleanup_free_ *config_path = NULL;
+ _cleanup_free_ char *config_path = NULL;
int r;
assert(scope >= 0);
@@ -1492,11 +1492,11 @@ int unit_file_disable(
UnitFileChange **changes,
unsigned *n_changes) {
- LookupPaths _cleanup_lookup_paths_free_ paths = {};
- InstallContext _cleanup_install_context_done_ c = {};
+ _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_install_context_done_ InstallContext c = {};
char **i;
- char _cleanup_free_ *config_path = NULL;
- Set _cleanup_set_free_free_ *remove_symlinks_to = NULL;
+ _cleanup_free_ char *config_path = NULL;
+ _cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
int r, q;
assert(scope >= 0);
@@ -1534,11 +1534,11 @@ int unit_file_reenable(
UnitFileChange **changes,
unsigned *n_changes) {
- LookupPaths _cleanup_lookup_paths_free_ paths = {};
- InstallContext _cleanup_install_context_done_ c = {};
+ _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_install_context_done_ InstallContext c = {};
char **i;
- char _cleanup_free_ *config_path = NULL;
- Set _cleanup_set_free_free_ *remove_symlinks_to = NULL;
+ _cleanup_free_ char *config_path = NULL;
+ _cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
int r, q;
assert(scope >= 0);
@@ -1577,10 +1577,10 @@ UnitFileState unit_file_get_state(
const char *root_dir,
const char *name) {
- LookupPaths _cleanup_lookup_paths_free_ paths = {};
+ _cleanup_lookup_paths_free_ LookupPaths paths = {};
UnitFileState state = _UNIT_FILE_STATE_INVALID;
char **i;
- char _cleanup_free_ *path = NULL;
+ _cleanup_free_ char *path = NULL;
int r;
assert(scope >= 0);
@@ -1650,7 +1650,7 @@ UnitFileState unit_file_get_state(
}
int unit_file_query_preset(UnitFileScope scope, const char *name) {
- char _cleanup_strv_free_ **files = NULL;
+ _cleanup_strv_free_ char **files = NULL;
char **i;
int r;
@@ -1680,7 +1680,7 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) {
return r;
STRV_FOREACH(i, files) {
- FILE _cleanup_fclose_ *f;
+ _cleanup_fclose_ FILE *f;
f = fopen(*i, "re");
if (!f) {
@@ -1735,11 +1735,11 @@ int unit_file_preset(
UnitFileChange **changes,
unsigned *n_changes) {
- LookupPaths _cleanup_lookup_paths_free_ paths = {};
- InstallContext _cleanup_install_context_done_ plus = {}, minus = {};
+ _cleanup_lookup_paths_free_ LookupPaths paths = {};
+ _cleanup_install_context_done_ InstallContext plus = {}, minus = {};
char **i;
- char _cleanup_free_ *config_path = NULL;
- Set _cleanup_set_free_free_ *remove_symlinks_to = NULL;
+ _cleanup_free_ char *config_path = NULL;
+ _cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
int r, q;
assert(scope >= 0);
@@ -1801,10 +1801,10 @@ int unit_file_get_list(
const char *root_dir,
Hashmap *h) {
- LookupPaths _cleanup_lookup_paths_free_ paths = {};
+ _cleanup_lookup_paths_free_ LookupPaths paths = {};
char **i;
- char _cleanup_free_ *buf = NULL;
- DIR _cleanup_closedir_ *d = NULL;
+ _cleanup_free_ char *buf = NULL;
+ _cleanup_closedir_ DIR *d = NULL;
int r;
assert(scope >= 0);
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 5700321215..116dc8a36c 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -278,7 +278,7 @@ static int output_short(
} else if ((flags & OUTPUT_FULL_WIDTH) || (message_len + n + 1 < n_columns))
fprintf(f, ": %s%.*s%s\n", color_on, (int) message_len, message, color_off);
else if (n < n_columns && n_columns - n - 2 >= 3) {
- char _cleanup_free_ *e;
+ _cleanup_free_ char *e;
e = ellipsize_mem(message, message_len, n_columns - n - 2, 90);
@@ -304,7 +304,7 @@ static int output_verbose(
const void *data;
size_t length;
- char _cleanup_free_ *cursor = NULL;
+ _cleanup_free_ char *cursor = NULL;
uint64_t realtime;
char ts[FORMAT_TIMESTAMP_MAX];
int r;
@@ -366,7 +366,7 @@ static int output_export(
char sid[33];
int r;
usec_t realtime, monotonic;
- char _cleanup_free_ *cursor = NULL;
+ _cleanup_free_ char *cursor = NULL;
const void *data;
size_t length;
@@ -495,7 +495,7 @@ static int output_json(
OutputFlags flags) {
uint64_t realtime, monotonic;
- char _cleanup_free_ *cursor = NULL;
+ _cleanup_free_ char *cursor = NULL;
const void *data;
size_t length;
sd_id128_t boot_id;
@@ -942,7 +942,7 @@ int show_journal_by_unit(
OutputFlags flags,
bool system) {
- sd_journal _cleanup_journal_close_ *j = NULL;
+ _cleanup_journal_close_ sd_journal*j = NULL;
int r;
int jflags = SD_JOURNAL_LOCAL_ONLY | system * SD_JOURNAL_SYSTEM_ONLY;
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index 6bb390fc90..1a47ea9ce7 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -322,7 +322,7 @@ int lookup_paths_init(
strv_uniq(p->unit_path);
if (!strv_isempty(p->unit_path)) {
- char _cleanup_free_ *t = strv_join(p->unit_path, "\n\t");
+ _cleanup_free_ char *t = strv_join(p->unit_path, "\n\t");
if (!t)
return -ENOMEM;
log_debug("Looking for unit files in (higher priority first):\n\t%s", t);
@@ -382,7 +382,7 @@ int lookup_paths_init(
strv_uniq(p->sysvrcnd_path);
if (!strv_isempty(p->sysvinit_path)) {
- char _cleanup_free_ *t = strv_join(p->sysvinit_path, "\n\t");
+ _cleanup_free_ char *t = strv_join(p->sysvinit_path, "\n\t");
if (!t)
return -ENOMEM;
log_debug("Looking for SysV init scripts in:\n\t%s", t);
@@ -393,7 +393,7 @@ int lookup_paths_init(
}
if (!strv_isempty(p->sysvrcnd_path)) {
- char _cleanup_free_ *t =
+ _cleanup_free_ char *t =
strv_join(p->sysvrcnd_path, "\n\t");
if (!t)
return -ENOMEM;
diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c
index 4933fe08e2..c583d3dfea 100644
--- a/src/shared/socket-util.c
+++ b/src/shared/socket-util.c
@@ -364,7 +364,7 @@ int socket_address_print(const SocketAddress *a, char **p) {
}
case AF_NETLINK: {
- char _cleanup_free_ *sfamily = NULL;
+ _cleanup_free_ char *sfamily = NULL;
r = netlink_family_to_string_alloc(a->protocol, &sfamily);
if (r < 0)
@@ -568,7 +568,7 @@ bool socket_address_matches_fd(const SocketAddress *a, int fd) {
int make_socket_fd(const char* address, int flags) {
SocketAddress a;
int fd, r;
- char _cleanup_free_ *p = NULL;
+ _cleanup_free_ char *p = NULL;
r = socket_address_parse(&a, address);
if (r < 0) {
diff --git a/src/shared/util.c b/src/shared/util.c
index e8431839b0..1fc6c5aa1a 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2080,7 +2080,7 @@ int release_terminal(void) {
.sa_handler = SIG_IGN,
.sa_flags = SA_RESTART,
};
- int _cleanup_close_ fd;
+ _cleanup_close_ int fd;
fd = open("/dev/tty", O_RDWR|O_NOCTTY|O_NDELAY|O_CLOEXEC);
if (fd < 0)
@@ -4344,7 +4344,7 @@ int in_group(const char *name) {
}
int glob_exists(const char *path) {
- glob_t _cleanup_globfree_ g = {};
+ _cleanup_globfree_ glob_t g = {};
int r, k;
assert(path);
diff --git a/src/shared/utmp-wtmp.c b/src/shared/utmp-wtmp.c
index 5ee3d22e71..342e0a9cf1 100644
--- a/src/shared/utmp-wtmp.c
+++ b/src/shared/utmp-wtmp.c
@@ -287,7 +287,7 @@ int utmp_put_runlevel(int runlevel, int previous) {
#define TIMEOUT_MSEC 50
static int write_to_terminal(const char *tty, const char *message) {
- int _cleanup_close_ fd = -1;
+ _cleanup_close_ int fd = -1;
const char *p;
size_t left;
usec_t end;
diff --git a/src/shared/virt.c b/src/shared/virt.c
index 7b18e58c16..1c86a3dd1e 100644
--- a/src/shared/virt.c
+++ b/src/shared/virt.c
@@ -168,7 +168,7 @@ int detect_vm(const char **id) {
}
int detect_container(const char **id) {
- char _cleanup_free_ *e = NULL;
+ _cleanup_free_ char *e = NULL;
int r;
/* Unfortunately many of these operations require root access