Skip to content

Commit

Permalink
Use #pragma once in header files
Browse files Browse the repository at this point in the history
All compilers have supported this for at least the 5 years, some like gcc and
clang much longer.

Signed-off-by: Richard Hughes <[email protected]>
  • Loading branch information
hughsie authored and vathpela committed Feb 19, 2024
1 parent 0ca99d4 commit 9cbf722
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 25 deletions.
5 changes: 2 additions & 3 deletions src/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EFIBOOTMGR_ERROR_H__
#define EFIBOOTMGR_ERROR_H__ 1

#pragma once

extern int verbose;

Expand Down Expand Up @@ -163,4 +163,3 @@ warningx(const char *fmt, ...)
conditional_error_reporter(verbose >= 1, 1);
va_end(ap);
}
#endif /* EFIBOOTMGR_ERROR_H__ */
4 changes: 1 addition & 3 deletions src/fix_coverity.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* Distributed under terms of the GPLv3 license.
*/

#ifndef FIX_COVERITY_H
#define FIX_COVERITY_H
#pragma once

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
Expand Down Expand Up @@ -90,5 +89,4 @@ typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
#undef __COVERITY_GCC_VERSION_AT_LEAST
#endif

#endif /* !FIX_COVERITY_H */
// vim:fenc=utf-8:tw=75
5 changes: 1 addition & 4 deletions src/include/efi.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#ifndef EFI_H
#define EFI_H
#pragma once

/*
* Extensible Firmware Interface
Expand Down Expand Up @@ -69,5 +68,3 @@ typedef struct {

#define ADDRESS_RANGE_MIRROR_VARIABLE_CURRENT "MirrorCurrent"
#define ADDRESS_RANGE_MIRROR_VARIABLE_REQUEST "MirrorRequest"

#endif /* EFI_H */
5 changes: 1 addition & 4 deletions src/include/efibootmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#ifndef _EFIBOOTMGR_H
#define _EFIBOOTMGR_H
#pragma once

#define EFIBOOTMGR_IPV4 0
#define EFIBOOTMGR_IPV6 1
Expand Down Expand Up @@ -99,5 +98,3 @@ typedef struct {
} efibootmgr_opt_t;

extern efibootmgr_opt_t opts;

#endif
8 changes: 1 addition & 7 deletions src/include/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
Copied from the Linux 2.4.4 kernel, in linux/include/linux/list.h
*/

#ifndef _LINUX_LIST_H
#define _LINUX_LIST_H

#pragma once

/*
* Simple doubly linked list implementation.
Expand Down Expand Up @@ -163,7 +161,3 @@ static __inline__ void list_splice(struct list_head *list, struct list_head *hea
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)



#endif
5 changes: 1 addition & 4 deletions src/include/parse_loader_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#ifndef _PARSE_LOADER_DATA_H
#define _PARSE_LOADER_DATA_H
#pragma once

#include <stdint.h>
#include "efi.h"
Expand All @@ -27,5 +26,3 @@ ssize_t parse_efi_guid(char *buffer, size_t buffer_size,
uint8_t *p, uint64_t length);
ssize_t parse_raw_text(char *buffer, size_t buffer_size,
uint8_t *p, uint64_t length);

#endif

0 comments on commit 9cbf722

Please sign in to comment.