]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
Use #pragma once instead of #ifndef
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Wed, 18 Jul 2012 13:19:48 +0000 (10:19 -0300)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Wed, 18 Jul 2012 13:31:50 +0000 (10:31 -0300)
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.

libkmod/libkmod-array.h
libkmod/libkmod-hash.h
libkmod/libkmod-index.h
libkmod/libkmod-private.h
libkmod/libkmod-util.h
libkmod/libkmod.h
libkmod/macro.h
testsuite/mkdir.h
testsuite/stripped-module.h
testsuite/testsuite.h
tools/kmod.h

index 6400993b4ed90c7c8670a64903e84882db791746..dd2ba5525f2331a09403ea139b6efe6345d84889 100644 (file)
@@ -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
index 8f20b8f4e2d964f6bcdfb6a53a2a686253d4c3fe..ca0af05724851c21fc61aa9143dd84da3af4b050 100644 (file)
@@ -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
index dd3a76265d2a4f7798fc938301eb421c83c329b8..6eb77b9380a2de2cd53e7430715e3f60f750b13b 100644 (file)
@@ -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
index 7c2602d9e7762450006077878f12450d10829f58..90618540a9b5c842730117aaad8b9b763c6f9331 100644 (file)
@@ -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
index 7130ae021f7819080f8083bf82e0efbb3eca4b85..5fe3e02e2737a761591183ef76ecab91a9eaac89 100644 (file)
@@ -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
index f907e1d841afe9862c38519616a2472bd26317c7..2f813a85f9e569d1e70cc9d9a7692464489ab8a9 100644 (file)
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#pragma once
 #ifndef _LIBKMOD_H_
 #define _LIBKMOD_H_
 
index e5c9763cabd207f7ab48c4f026b279475ab8eb33..689c57ab9483db2e66332272c401bd849b55c003 100644 (file)
@@ -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
index 2530bd71881a6896ec4d0eff60e276f48312e958..35f6a1d14970ca3f0ecda958ccceebef582088c7 100644 (file)
  * 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
index 19862f3c3cd8e20a326db13222fb253345959d62..83986b2c44b373fdda71d76f93d8ae407352ac2f 100644 (file)
@@ -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
index 1666054513d9f2b225f5796800541d42abe01d12..1f8eb6ea1e4a50019300350be6d2902f5075783b 100644 (file)
@@ -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))
index 8717aec0da7b54cd27b93dc5c8c58815dd9e4f87..76a3426bb6d9215c37a3ca9687bca68990ec14ec 100644 (file)
@@ -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