aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2012-07-18 10:19:48 -0300
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2012-07-18 10:31:50 -0300
commite8fd8fec236062e94e9486c64e482b780988f9bf (patch)
tree8a2682f3bcb0f40af1ca0ed3680c85ececd804da
parent4e7f0f204bc82ce749cad6613b066993f530cbe6 (diff)
downloadkmod-e8fd8fec236062e94e9486c64e482b780988f9bf.tar.gz
Use #pragma once instead of #ifndef
Only the public header maintains #ifndef in the header, together with pragma. The other ones contain only pragma. As reported by Shawn Landden on systemd mailing list this is compatible with all major compilers and gcc has this since version 3.3.
-rw-r--r--libkmod/libkmod-array.h5
-rw-r--r--libkmod/libkmod-hash.h5
-rw-r--r--libkmod/libkmod-index.h5
-rw-r--r--libkmod/libkmod-private.h5
-rw-r--r--libkmod/libkmod-util.h6
-rw-r--r--libkmod/libkmod.h1
-rw-r--r--libkmod/macro.h6
-rw-r--r--testsuite/mkdir.h5
-rw-r--r--testsuite/stripped-module.h5
-rw-r--r--testsuite/testsuite.h5
-rw-r--r--tools/kmod.h4
11 files changed, 11 insertions, 41 deletions
diff --git a/libkmod/libkmod-array.h b/libkmod/libkmod-array.h
index 6400993..dd2ba55 100644
--- a/libkmod/libkmod-array.h
+++ b/libkmod/libkmod-array.h
@@ -1,5 +1,4 @@
-#ifndef _LIBKMOD_ARRAY_H_
-#define _LIBKMOD_ARRAY_H_
+#pragma once
/*
* Declaration of struct array is in header because we may want to embed the
@@ -19,5 +18,3 @@ void array_pop(struct array *array);
void array_free_array(struct array *array);
void array_sort(struct array *array, int (*cmp)(const void *a, const void *b));
int array_remove_at(struct array *array, unsigned int pos);
-
-#endif
diff --git a/libkmod/libkmod-hash.h b/libkmod/libkmod-hash.h
index 8f20b8f..ca0af05 100644
--- a/libkmod/libkmod-hash.h
+++ b/libkmod/libkmod-hash.h
@@ -1,5 +1,4 @@
-#ifndef _LIBKMOD_HASH_H_
-#define _LIBKMOD_HASH_H_
+#pragma once
#include <stdbool.h>
@@ -21,5 +20,3 @@ unsigned int hash_get_count(const struct hash *hash);
void hash_iter_init(const struct hash *hash, struct hash_iter *iter);
bool hash_iter_next(struct hash_iter *iter, const char **key,
const void **value);
-
-#endif
diff --git a/libkmod/libkmod-index.h b/libkmod/libkmod-index.h
index dd3a762..6eb77b9 100644
--- a/libkmod/libkmod-index.h
+++ b/libkmod/libkmod-index.h
@@ -18,8 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _LIBKMOD_INDEX_H
-#define _LIBKMOD_INDEX_H
+#pragma once
#include <stdint.h>
@@ -127,5 +126,3 @@ void index_mm_close(struct index_mm *index);
char *index_mm_search(struct index_mm *idx, const char *key);
struct index_value *index_mm_searchwild(struct index_mm *idx, const char *key);
void index_mm_dump(struct index_mm *idx, int fd, const char *prefix);
-
-#endif
diff --git a/libkmod/libkmod-private.h b/libkmod/libkmod-private.h
index 7c2602d..9061854 100644
--- a/libkmod/libkmod-private.h
+++ b/libkmod/libkmod-private.h
@@ -1,5 +1,4 @@
-#ifndef _LIBKMOD_PRIVATE_H_
-#define _LIBKMOD_PRIVATE_H_
+#pragma once
#include <stdbool.h>
#include <stdio.h>
@@ -170,5 +169,3 @@ int kmod_elf_get_section(const struct kmod_elf *elf, const char *section, const
/* util functions */
#include "libkmod-util.h"
-
-#endif
diff --git a/libkmod/libkmod-util.h b/libkmod/libkmod-util.h
index 7130ae0..5fe3e02 100644
--- a/libkmod/libkmod-util.h
+++ b/libkmod/libkmod-util.h
@@ -1,6 +1,4 @@
-#ifndef _LIBKMOD_UTIL_H_
-#define _LIBKMOD_UTIL_H_
-
+#pragma once
#include "macro.h"
#include <limits.h>
@@ -42,5 +40,3 @@ do { \
} *__p = (typeof(__p)) (ptr); \
__p->__v = (val); \
} while(0)
-
-#endif
diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h
index f907e1d..2f813a8 100644
--- a/libkmod/libkmod.h
+++ b/libkmod/libkmod.h
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#pragma once
#ifndef _LIBKMOD_H_
#define _LIBKMOD_H_
diff --git a/libkmod/macro.h b/libkmod/macro.h
index e5c9763..689c57a 100644
--- a/libkmod/macro.h
+++ b/libkmod/macro.h
@@ -17,9 +17,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-#ifndef _LIBKMOD_MACRO_H_
-#define _LIBKMOD_MACRO_H_
+#pragma once
#include <stddef.h>
@@ -82,5 +80,3 @@
#define _printf_format_(a,b) __attribute__((format (printf, a, b)))
#define _unused_ __attribute__((unused))
#define _always_inline_ __inline__ __attribute__((always_inline))
-
-#endif
diff --git a/testsuite/mkdir.h b/testsuite/mkdir.h
index 2530bd7..35f6a1d 100644
--- a/testsuite/mkdir.h
+++ b/testsuite/mkdir.h
@@ -16,12 +16,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _LIBKMOD_TESTSUITE_MKDIR_
-#define _LIBKMOD_TESTSUITE_MKDIR_
+#pragma once
#include <sys/stat.h>
#include <sys/types.h>
int mkdir_p(const char *path, mode_t mode);
-
-#endif
diff --git a/testsuite/stripped-module.h b/testsuite/stripped-module.h
index 19862f3..83986b2 100644
--- a/testsuite/stripped-module.h
+++ b/testsuite/stripped-module.h
@@ -1,5 +1,4 @@
-#ifndef _TESTSUITE_STRIPPED_MODULE_H
-#define _TESTSUITE_STRIPPED_MODULE_H
+#pragma once
enum module_state
{
@@ -28,5 +27,3 @@ struct module
/* padding */
#define MODULE_NAME_OFFSET_64 4 + 4 + 2 * 8
#define MODULE_NAME_OFFSET_32 4 + 2 * 4
-
-#endif
diff --git a/testsuite/testsuite.h b/testsuite/testsuite.h
index 1666054..1f8eb6e 100644
--- a/testsuite/testsuite.h
+++ b/testsuite/testsuite.h
@@ -16,8 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _LIBKMOD_TESTSUITE_
-#define _LIBKMOD_TESTSUITE_
+#pragma once
#include <stdbool.h>
#include <stdarg.h>
@@ -144,6 +143,4 @@ int test_run(const struct test *t);
exit(EXIT_SUCCESS); \
} \
-#endif
-
#define __noreturn __attribute__((noreturn))
diff --git a/tools/kmod.h b/tools/kmod.h
index 8717aec..76a3426 100644
--- a/tools/kmod.h
+++ b/tools/kmod.h
@@ -17,8 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _KMOD_MACRO_H_
-#define _KMOD_MACRO_H_
+#pragma once
#include "macro.h"
@@ -36,4 +35,3 @@ extern const struct kmod_cmd kmod_cmd_compat_modprobe;
extern const struct kmod_cmd kmod_cmd_compat_depmod;
extern const struct kmod_cmd kmod_cmd_list;
-#endif