From c2f1db8f83618e60dcded8303d14656d7d26b436 Mon Sep 17 00:00:00 2001 From: Shawn Landden Date: Wed, 18 Jul 2012 10:07:51 -0700 Subject: 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 --- src/journal/compress.h | 5 +---- src/journal/journal-def.h | 5 +---- src/journal/journal-file.h | 5 +---- src/journal/journal-internal.h | 4 +--- src/journal/journal-rate-limit.h | 5 +---- src/journal/journald.h | 5 +---- src/journal/lookup3.h | 5 +---- 7 files changed, 7 insertions(+), 27 deletions(-) (limited to 'src/journal') diff --git a/src/journal/compress.h b/src/journal/compress.h index 1cdfe3d481..b6f1aa0ed7 100644 --- a/src/journal/compress.h +++ b/src/journal/compress.h @@ -1,7 +1,6 @@ /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ -#ifndef foocompresshfoo -#define foocompresshfoo +#pragma once /*** This file is part of systemd. @@ -34,5 +33,3 @@ bool uncompress_startswith(const void *src, uint64_t src_size, void **buffer, uint64_t *buffer_size, const void *prefix, uint64_t prefix_len, uint8_t extra); - -#endif diff --git a/src/journal/journal-def.h b/src/journal/journal-def.h index ac89e61d93..096dd8ed83 100644 --- a/src/journal/journal-def.h +++ b/src/journal/journal-def.h @@ -1,7 +1,6 @@ /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ -#ifndef foojournaldefhfoo -#define foojournaldefhfoo +#pragma once /*** This file is part of systemd. @@ -182,5 +181,3 @@ _packed_ struct Header { le64_t n_data; le64_t n_fields; }; - -#endif diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h index 1f7f73a78d..eed49e062f 100644 --- a/src/journal/journal-file.h +++ b/src/journal/journal-file.h @@ -1,7 +1,6 @@ /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ -#ifndef foojournalfilehfoo -#define foojournalfilehfoo +#pragma once /*** This file is part of systemd. @@ -147,5 +146,3 @@ int journal_file_get_cutoff_realtime_usec(JournalFile *f, usec_t *from, usec_t * int journal_file_get_cutoff_monotonic_usec(JournalFile *f, sd_id128_t boot, usec_t *from, usec_t *to); bool journal_file_rotate_suggested(JournalFile *f); - -#endif diff --git a/src/journal/journal-internal.h b/src/journal/journal-internal.h index 04f77540c9..d17fdb2e92 100644 --- a/src/journal/journal-internal.h +++ b/src/journal/journal-internal.h @@ -1,7 +1,6 @@ /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ -#ifndef foojournalinternalhfoo -#define foojournalinternalhfoo +#pragma once /*** This file is part of systemd. @@ -112,4 +111,3 @@ struct sd_journal { char *journal_make_match_string(sd_journal *j); void journal_print_header(sd_journal *j); -#endif diff --git a/src/journal/journal-rate-limit.h b/src/journal/journal-rate-limit.h index cbf526c64f..648ab22786 100644 --- a/src/journal/journal-rate-limit.h +++ b/src/journal/journal-rate-limit.h @@ -1,7 +1,6 @@ /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ -#ifndef foojournalratelimithfoo -#define foojournalratelimithfoo +#pragma once /*** This file is part of systemd. @@ -30,5 +29,3 @@ typedef struct JournalRateLimit JournalRateLimit; JournalRateLimit *journal_rate_limit_new(usec_t interval, unsigned burst); void journal_rate_limit_free(JournalRateLimit *r); int journal_rate_limit_test(JournalRateLimit *r, const char *id, int priority, uint64_t available); - -#endif diff --git a/src/journal/journald.h b/src/journal/journald.h index 3537a49420..acf19b4e7a 100644 --- a/src/journal/journald.h +++ b/src/journal/journald.h @@ -1,7 +1,6 @@ /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ -#ifndef foojournaldhfoo -#define foojournaldhfoo +#pragma once /*** This file is part of systemd. @@ -106,5 +105,3 @@ int config_parse_storage(const char *filename, unsigned line, const char *sectio const char *storage_to_string(Storage s); Storage storage_from_string(const char *s); - -#endif diff --git a/src/journal/lookup3.h b/src/journal/lookup3.h index 31cc2f57b0..502b42c209 100644 --- a/src/journal/lookup3.h +++ b/src/journal/lookup3.h @@ -1,7 +1,6 @@ /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ -#ifndef foolookup3hfoo -#define foolookup3hfoo +#pragma once #include #include @@ -21,5 +20,3 @@ static inline uint64_t hash64(const void *data, size_t length) { return ((uint64_t) a << 32ULL) | (uint64_t) b; } - -#endif -- cgit v1.2.3-54-g00ecf