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
This commit is contained in:
committed by
Lennart Poettering
parent
4a842cadb8
commit
c2f1db8f83
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-4
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-4
@@ -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
|
||||
|
||||
+1
-4
@@ -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
|
||||
|
||||
+1
-4
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-4
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-4
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-4
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-4
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-4
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-4
@@ -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
|
||||
|
||||
+1
-4
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-4
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user