summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorShawn Landden <shawnlandden@gmail.com>2012-07-18 10:07:51 -0700
committerLennart Poettering <lennart@poettering.net>2012-07-19 12:30:59 +0200
commitc2f1db8f83618e60dcded8303d14656d7d26b436 (patch)
tree89d1212990819ff53f20680096497a2f1dd50b41 /src/shared
parent4a842cadb8d6b30fa9fdc8ff183633c14e02cf96 (diff)
use #pragma once instead of foo*foo #define guards
#pragma once has been "un-deprecated" in gcc since 3.3, and is widely supported in other compilers. I've been using and maintaining (rebasing) this patch for a while now, as it annoyed me to see #ifndef fooblahfoo, etc all over the place, almost arrogant about the annoyance of having to define all these names to perform a commen but neccicary functionality, when a completely superior alternative exists. I havn't sent it till now, cause its kindof a style change, and it is bad voodoo to mess with style that has been established by more established editors. So feel free to lambast me as a crazy bafoon. v2 - preserve externally used headers
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/acl-util.h5
-rw-r--r--src/shared/ask-password-api.h5
-rw-r--r--src/shared/cgroup-util.h5
-rw-r--r--src/shared/conf-parser.h5
-rw-r--r--src/shared/dbus-common.h5
-rw-r--r--src/shared/dbus-loop.h5
-rw-r--r--src/shared/def.h5
-rw-r--r--src/shared/exit-status.h5
-rw-r--r--src/shared/hashmap.h5
-rw-r--r--src/shared/install.h5
-rw-r--r--src/shared/label.h5
-rw-r--r--src/shared/list.h5
-rw-r--r--src/shared/log.h5
-rw-r--r--src/shared/logs-show.h5
-rw-r--r--src/shared/macro.h5
-rw-r--r--src/shared/missing.h5
-rw-r--r--src/shared/pager.h5
-rw-r--r--src/shared/path-lookup.h5
-rw-r--r--src/shared/polkit.h5
-rw-r--r--src/shared/ratelimit.h5
-rw-r--r--src/shared/set.h5
-rw-r--r--src/shared/socket-util.h5
-rw-r--r--src/shared/spawn-ask-password-agent.h5
-rw-r--r--src/shared/specifier.h5
-rw-r--r--src/shared/strv.h5
-rw-r--r--src/shared/unit-name.h5
-rw-r--r--src/shared/utf8.h5
-rw-r--r--src/shared/util.h5
-rw-r--r--src/shared/utmp-wtmp.h5
-rw-r--r--src/shared/virt.h5
-rw-r--r--src/shared/watchdog.h5
31 files changed, 31 insertions, 124 deletions
diff --git a/src/shared/acl-util.h b/src/shared/acl-util.h
index 9f11636aa1..31fbbcd510 100644
--- a/src/shared/acl-util.h
+++ b/src/shared/acl-util.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef fooaclutilhfoo
-#define fooaclutilhfoo
+#pragma once
/***
This file is part of systemd.
@@ -23,5 +22,3 @@
***/
int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry);
-
-#endif
diff --git a/src/shared/ask-password-api.h b/src/shared/ask-password-api.h
index 155afad33b..288a0f48cf 100644
--- a/src/shared/ask-password-api.h
+++ b/src/shared/ask-password-api.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef fooaskpasswordapihfoo
-#define fooaskpasswordapihfoo
+#pragma once
/***
This file is part of systemd.
@@ -29,5 +28,3 @@ int ask_password_tty(const char *message, usec_t until, const char *flag_file, c
int ask_password_agent(const char *message, const char *icon, usec_t until, bool accept_cached, char ***_passphrases);
int ask_password_auto(const char *message, const char *icon, usec_t until, bool accept_cached, char ***_passphrases);
-
-#endif
diff --git a/src/shared/cgroup-util.h b/src/shared/cgroup-util.h
index 7f11bc6f83..697669deba 100644
--- a/src/shared/cgroup-util.h
+++ b/src/shared/cgroup-util.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foocgrouputilhfoo
-#define foocgrouputilhfoo
+#pragma once
/***
This file is part of systemd.
@@ -73,5 +72,3 @@ int cg_pid_get_cgroup(pid_t pid, char **root, char **cgroup);
int cg_pid_get_unit(pid_t pid, char **unit);
char **cg_shorten_controllers(char **controllers);
-
-#endif
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
index 2e01f9ef93..4f94b3b907 100644
--- a/src/shared/conf-parser.h
+++ b/src/shared/conf-parser.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef fooconfparserhfoo
-#define fooconfparserhfoo
+#pragma once
/***
This file is part of systemd.
@@ -134,5 +133,3 @@ int config_parse_level(const char *filename, unsigned line, const char *section,
\
return 0; \
}
-
-#endif
diff --git a/src/shared/dbus-common.h b/src/shared/dbus-common.h
index 9ae35df9c5..a6703a78d0 100644
--- a/src/shared/dbus-common.h
+++ b/src/shared/dbus-common.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foodbuscommonhfoo
-#define foodbuscommonhfoo
+#pragma once
/***
This file is part of systemd.
@@ -204,5 +203,3 @@ void bus_async_unregister_and_exit(DBusConnection *bus, const char *name);
DBusHandlerResult bus_exit_idle_filter(DBusConnection *bus, DBusMessage *m, void *userdata);
pid_t bus_get_unix_process_id(DBusConnection *connection, const char *name, DBusError *error);
-
-#endif
diff --git a/src/shared/dbus-loop.h b/src/shared/dbus-loop.h
index 3902b354cf..a5e768d931 100644
--- a/src/shared/dbus-loop.h
+++ b/src/shared/dbus-loop.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foodbusloophfoo
-#define foodbusloophfoo
+#pragma once
/***
This file is part of systemd.
@@ -26,5 +25,3 @@
int bus_loop_open(DBusConnection *c);
int bus_loop_dispatch(int fd);
-
-#endif
diff --git a/src/shared/def.h b/src/shared/def.h
index d021e66021..5ba170f965 100644
--- a/src/shared/def.h
+++ b/src/shared/def.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foodefhfoo
-#define foodefhfoo
+#pragma once
/***
This file is part of systemd.
@@ -34,5 +33,3 @@
#define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT
#define SIGNALS_IGNORE SIGKILL,SIGPIPE
-
-#endif
diff --git a/src/shared/exit-status.h b/src/shared/exit-status.h
index 813f1ce1b4..3f42c15e3b 100644
--- a/src/shared/exit-status.h
+++ b/src/shared/exit-status.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef fooexitstatushfoo
-#define fooexitstatushfoo
+#pragma once
/***
This file is part of systemd.
@@ -82,5 +81,3 @@ const char* exit_status_to_string(ExitStatus status, ExitStatusLevel level);
bool is_clean_exit(int code, int status);
bool is_clean_exit_lsb(int code, int status);
-
-#endif
diff --git a/src/shared/hashmap.h b/src/shared/hashmap.h
index deefd9a804..ee810f5ae1 100644
--- a/src/shared/hashmap.h
+++ b/src/shared/hashmap.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foohashmaphfoo
-#define foohashmaphfoo
+#pragma once
/***
This file is part of systemd.
@@ -89,5 +88,3 @@ char **hashmap_get_strv(Hashmap *h);
#define HASHMAP_FOREACH_BACKWARDS(e, h, i) \
for ((i) = ITERATOR_LAST, (e) = hashmap_iterate_backwards((h), &(i), NULL); (e); (e) = hashmap_iterate_backwards((h), &(i), NULL))
-
-#endif
diff --git a/src/shared/install.h b/src/shared/install.h
index d365c01bc7..f02fa3efbd 100644
--- a/src/shared/install.h
+++ b/src/shared/install.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef fooinstallhfoo
-#define fooinstallhfoo
+#pragma once
/***
This file is part of systemd.
@@ -85,5 +84,3 @@ UnitFileState unit_file_state_from_string(const char *s);
const char *unit_file_change_type_to_string(UnitFileChangeType s);
UnitFileChangeType unit_file_change_type_from_string(const char *s);
-
-#endif
diff --git a/src/shared/label.h b/src/shared/label.h
index 8d832f9a59..1220b18965 100644
--- a/src/shared/label.h
+++ b/src/shared/label.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foolabelhfoo
-#define foolabelhfoo
+#pragma once
/***
This file is part of systemd.
@@ -46,5 +45,3 @@ int label_mkdir(const char *path, mode_t mode, bool apply);
void label_retest_selinux(void);
int label_bind(int fd, const struct sockaddr *addr, socklen_t addrlen);
-
-#endif
diff --git a/src/shared/list.h b/src/shared/list.h
index 9a491b990e..47f275a019 100644
--- a/src/shared/list.h
+++ b/src/shared/list.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foolisthfoo
-#define foolisthfoo
+#pragma once
/***
This file is part of systemd.
@@ -124,5 +123,3 @@
#define LIST_FOREACH_AFTER(name,i,p) \
for ((i) = (p)->name##_next; (i); (i) = (i)->name##_next)
-
-#endif
diff --git a/src/shared/log.h b/src/shared/log.h
index 59d4c00f7d..c986b2579d 100644
--- a/src/shared/log.h
+++ b/src/shared/log.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foologhfoo
-#define foologhfoo
+#pragma once
/***
This file is part of systemd.
@@ -108,5 +107,3 @@ int log_dump_internal(
const char *log_target_to_string(LogTarget target);
LogTarget log_target_from_string(const char *s);
-
-#endif
diff --git a/src/shared/logs-show.h b/src/shared/logs-show.h
index 2e9cf63891..4e6743254b 100644
--- a/src/shared/logs-show.h
+++ b/src/shared/logs-show.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foologsshowhfoo
-#define foologsshowhfoo
+#pragma once
/***
This file is part of systemd.
@@ -60,5 +59,3 @@ int show_journal_by_unit(
const char* output_mode_to_string(OutputMode m);
OutputMode output_mode_from_string(const char *s);
-
-#endif
diff --git a/src/shared/macro.h b/src/shared/macro.h
index 97eebbc88b..4595750394 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foomacrohfoo
-#define foomacrohfoo
+#pragma once
/***
This file is part of systemd.
@@ -189,5 +188,3 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
}
#include "log.h"
-
-#endif
diff --git a/src/shared/missing.h b/src/shared/missing.h
index d918c4e9a7..e600acc0b1 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foomissinghfoo
-#define foomissinghfoo
+#pragma once
/***
This file is part of systemd.
@@ -191,5 +190,3 @@ static inline pid_t gettid(void) {
#ifndef PR_SET_NO_NEW_PRIVS
#define PR_SET_NO_NEW_PRIVS 38
#endif
-
-#endif
diff --git a/src/shared/pager.h b/src/shared/pager.h
index 7d2108f73e..dcd61957ef 100644
--- a/src/shared/pager.h
+++ b/src/shared/pager.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foopagerhfoo
-#define foopagerhfoo
+#pragma once
/***
This file is part of systemd.
@@ -24,5 +23,3 @@
void pager_open(void);
void pager_close(void);
-
-#endif
diff --git a/src/shared/path-lookup.h b/src/shared/path-lookup.h
index 96c49c2400..0aab956f25 100644
--- a/src/shared/path-lookup.h
+++ b/src/shared/path-lookup.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foopathlookuphfoo
-#define foopathlookuphfoo
+#pragma once
/***
This file is part of systemd.
@@ -36,5 +35,3 @@ int user_config_home(char **config_home);
int lookup_paths_init(LookupPaths *p, ManagerRunningAs running_as, bool personal, const char *generator, const char *generator_early, const char *generator_late);
void lookup_paths_free(LookupPaths *p);
-
-#endif
diff --git a/src/shared/polkit.h b/src/shared/polkit.h
index 5aecfff635..6255d1f617 100644
--- a/src/shared/polkit.h
+++ b/src/shared/polkit.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foopolkithfoo
-#define foopolkithfoo
+#pragma once
/***
This file is part of systemd.
@@ -32,5 +31,3 @@ int verify_polkit(
bool interactive,
bool *challenge,
DBusError *error);
-
-#endif
diff --git a/src/shared/ratelimit.h b/src/shared/ratelimit.h
index ad00267a6e..58efca7df1 100644
--- a/src/shared/ratelimit.h
+++ b/src/shared/ratelimit.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef fooratelimithfoo
-#define fooratelimithfoo
+#pragma once
/***
This file is part of systemd.
@@ -56,5 +55,3 @@ typedef struct RateLimit {
} while (false)
bool ratelimit_test(RateLimit *r);
-
-#endif
diff --git a/src/shared/set.h b/src/shared/set.h
index 18921df427..c7b6231eed 100644
--- a/src/shared/set.h
+++ b/src/shared/set.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foosethfoo
-#define foosethfoo
+#pragma once
/***
This file is part of systemd.
@@ -67,5 +66,3 @@ void* set_last(Set *s);
#define SET_FOREACH_BACKWARDS(e, s, i) \
for ((i) = ITERATOR_LAST, (e) = set_iterate_backwards((s), &(i)); (e); (e) = set_iterate_backwards((s), &(i)))
-
-#endif
diff --git a/src/shared/socket-util.h b/src/shared/socket-util.h
index a5a9463f18..7cca2f53c6 100644
--- a/src/shared/socket-util.h
+++ b/src/shared/socket-util.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foosocketutilhfoo
-#define foosocketutilhfoo
+#pragma once
/***
This file is part of systemd.
@@ -98,5 +97,3 @@ const char* netlink_family_to_string(int b);
int netlink_family_from_string(const char *s);
bool socket_ipv6_is_supported(void);
-
-#endif
diff --git a/src/shared/spawn-ask-password-agent.h b/src/shared/spawn-ask-password-agent.h
index fa5e7b0260..31b4beab58 100644
--- a/src/shared/spawn-ask-password-agent.h
+++ b/src/shared/spawn-ask-password-agent.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foospawnaskpasswordagenthfoo
-#define foospawnaskpasswordagenthfoo
+#pragma once
/***
This file is part of systemd.
@@ -24,5 +23,3 @@
int ask_password_agent_open(void);
void ask_password_agent_close(void);
-
-#endif
diff --git a/src/shared/specifier.h b/src/shared/specifier.h
index 57d1fcb35c..25a27a423f 100644
--- a/src/shared/specifier.h
+++ b/src/shared/specifier.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foospecifierhfoo
-#define foospecifierhfoo
+#pragma once
/***
This file is part of systemd.
@@ -33,5 +32,3 @@ typedef struct Specifier {
char *specifier_printf(const char *text, const Specifier table[], void *userdata);
char* specifier_string(char specifier, void *data, void *userdata);
-
-#endif
diff --git a/src/shared/strv.h b/src/shared/strv.h
index 635e92b728..ae4e31f14c 100644
--- a/src/shared/strv.h
+++ b/src/shared/strv.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foostrvhfoo
-#define foostrvhfoo
+#pragma once
/***
This file is part of systemd.
@@ -80,5 +79,3 @@ bool strv_overlap(char **a, char **b);
#define STRV_FOREACH_BACKWARDS(s, l) \
for (; (l) && ((s) >= (l)); (s)--)
-
-#endif
diff --git a/src/shared/unit-name.h b/src/shared/unit-name.h
index c6c09dd31f..f899f86528 100644
--- a/src/shared/unit-name.h
+++ b/src/shared/unit-name.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foounitnamehfoo
-#define foounitnamehfoo
+#pragma once
/***
This file is part of systemd.
@@ -92,5 +91,3 @@ char *unit_name_to_path(const char *name);
char *unit_dbus_path_from_name(const char *name);
char *unit_name_mangle(const char *name);
-
-#endif
diff --git a/src/shared/utf8.h b/src/shared/utf8.h
index fec76b487a..13d2f6a980 100644
--- a/src/shared/utf8.h
+++ b/src/shared/utf8.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef fooutf8hfoo
-#define fooutf8hfoo
+#pragma once
/***
This file is part of systemd.
@@ -31,5 +30,3 @@ char *utf8_is_printable_n(const char* str, size_t length) _pure_;
char *utf8_filter(const char *s);
char *ascii_filter(const char *s);
-
-#endif
diff --git a/src/shared/util.h b/src/shared/util.h
index 3915904442..d25b7ee1ee 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef fooutilhfoo
-#define fooutilhfoo
+#pragma once
/***
This file is part of systemd.
@@ -531,5 +530,3 @@ void warn_melody(void);
int get_shell(char **ret);
int get_home_dir(char **ret);
-
-#endif
diff --git a/src/shared/utmp-wtmp.h b/src/shared/utmp-wtmp.h
index ab950617a1..5924023203 100644
--- a/src/shared/utmp-wtmp.h
+++ b/src/shared/utmp-wtmp.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef fooutmpwtmphfoo
-#define fooutmpwtmphfoo
+#pragma once
/***
This file is part of systemd.
@@ -34,5 +33,3 @@ int utmp_put_dead_process(const char *id, pid_t pid, int code, int status);
int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line);
int utmp_wall(const char *message, bool (*match_tty)(const char *tty));
-
-#endif
diff --git a/src/shared/virt.h b/src/shared/virt.h
index 0b6dc1a9bd..aa6ad35ba9 100644
--- a/src/shared/virt.h
+++ b/src/shared/virt.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foovirthfoo
-#define foovirthfoo
+#pragma once
/***
This file is part of systemd.
@@ -34,5 +33,3 @@ typedef enum Virtualization {
} Virtualization;
Virtualization detect_virtualization(const char **id);
-
-#endif
diff --git a/src/shared/watchdog.h b/src/shared/watchdog.h
index 2e00cb9f4b..b748b15857 100644
--- a/src/shared/watchdog.h
+++ b/src/shared/watchdog.h
@@ -1,7 +1,6 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foowatchdoghfoo
-#define foowatchdoghfoo
+#pragma once
/***
This file is part of systemd.
@@ -27,5 +26,3 @@
int watchdog_set_timeout(usec_t *usec);
int watchdog_ping(void);
void watchdog_close(bool disarm);
-
-#endif