summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hanselmann <public@hansmi.ch>2021-08-12 20:13:03 +0200
committerMichael Hanselmann <public@hansmi.ch>2021-08-12 20:17:13 +0200
commit3a1ddfc3c7ef9ebbee4e6423fd2942337db793f7 (patch)
tree5293bbe132bbd7571075a10f0d3be84dcc9e7287
parent3dae79daa70c0b62e64fc6bf1b7e68757a812db0 (diff)
Use "#pragma once" as include guard
While "#pragma once" is not part of the C or C++ standards, it is a construct supported "by the vast majority of modern compilers"[1]. The previously used include guards starting with two underscores were also in violation of the relevant standards: identifiers starting with a double underscore ("__") are reserved for the implementation[2]. [1] https://en.cppreference.com/w/cpp/preprocessor/impl#.23pragma_once [2] https://eel.is/c++draft/lex.name#3.1 Signed-off-by: Michael Hanselmann <public@hansmi.ch>
-rw-r--r--usbredirhost/usbredirhost.h5
-rw-r--r--usbredirparser/strtok_r.h6
-rw-r--r--usbredirparser/usbredirfilter.h5
-rw-r--r--usbredirparser/usbredirparser.h5
-rw-r--r--usbredirparser/usbredirproto-compat.h5
-rw-r--r--usbredirparser/usbredirproto.h5
6 files changed, 6 insertions, 25 deletions
diff --git a/usbredirhost/usbredirhost.h b/usbredirhost/usbredirhost.h
index bd30e16..9e13610 100644
--- a/usbredirhost/usbredirhost.h
+++ b/usbredirhost/usbredirhost.h
@@ -18,8 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __USBREDIRHOST_H
-#define __USBREDIRHOST_H
+#pragma once
#include <libusb.h>
#include "usbredirparser.h"
@@ -182,5 +181,3 @@ int usbredirhost_check_device_filter(const struct usbredirfilter_rule *rules,
#ifdef __cplusplus
}
#endif
-
-#endif
diff --git a/usbredirparser/strtok_r.h b/usbredirparser/strtok_r.h
index 50e6e0e..fd08c15 100644
--- a/usbredirparser/strtok_r.h
+++ b/usbredirparser/strtok_r.h
@@ -16,11 +16,7 @@
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-
-#ifndef _USBREDIRPARSER_STRTOK_H_
-#define _USBREDIRPARSER_STRTOK_H_
+#pragma once
char *
glibc_strtok_r(char *s, const char *delim, char **save_ptr);
-
-#endif
diff --git a/usbredirparser/usbredirfilter.h b/usbredirparser/usbredirfilter.h
index eed4b51..eb015bf 100644
--- a/usbredirparser/usbredirfilter.h
+++ b/usbredirparser/usbredirfilter.h
@@ -18,8 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __USBREDIRFILTER_H
-#define __USBREDIRFILTER_H
+#pragma once
#include <stdio.h>
#include <stdint.h>
@@ -139,5 +138,3 @@ void usbredirfilter_free(void *ptr);
#ifdef __cplusplus
}
#endif
-
-#endif
diff --git a/usbredirparser/usbredirparser.h b/usbredirparser/usbredirparser.h
index 426b6d6..db0bc35 100644
--- a/usbredirparser/usbredirparser.h
+++ b/usbredirparser/usbredirparser.h
@@ -18,8 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __USBREDIRPARSER_H
-#define __USBREDIRPARSER_H
+#pragma once
#include "usbredirproto.h"
@@ -382,5 +381,3 @@ int usbredirparser_unserialize(struct usbredirparser *parser_pub,
#ifdef __cplusplus
}
#endif
-
-#endif
diff --git a/usbredirparser/usbredirproto-compat.h b/usbredirparser/usbredirproto-compat.h
index 9155d45..312abe8 100644
--- a/usbredirparser/usbredirproto-compat.h
+++ b/usbredirparser/usbredirproto-compat.h
@@ -18,8 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __USBREDIRPROTO_COMPAT_H
-#define __USBREDIRPROTO_COMPAT_H
+#pragma once
/* PACK macros borrowed from spice-protocol */
#ifdef __GNUC__
@@ -82,5 +81,3 @@ struct usb_redir_bulk_packet_header_16bit_length {
#if defined(__MINGW32__) || !defined(__GNUC__)
#pragma pack(pop)
#endif
-
-#endif
diff --git a/usbredirparser/usbredirproto.h b/usbredirparser/usbredirproto.h
index d1d51a4..667ffce 100644
--- a/usbredirparser/usbredirproto.h
+++ b/usbredirparser/usbredirproto.h
@@ -18,8 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __USBREDIRPROTO_H
-#define __USBREDIRPROTO_H
+#pragma once
/* PACK macros borrowed from spice-protocol */
#ifdef __GNUC__
@@ -303,5 +302,3 @@ struct usb_redir_buffered_bulk_packet_header {
#ifdef __cplusplus
}
#endif
-
-#endif