summaryrefslogtreecommitdiff
path: root/libgphoto2_port
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2021-10-05 15:50:32 +0200
committerHans Ulrich Niedermann <hun@n-dimensional.de>2021-10-05 16:07:20 +0200
commit0dbeaf7cbf30ab88ac7aea3e7d3f24df8dc0309f (patch)
tree5473eb1125e904a86e479180689167280a2e81dc /libgphoto2_port
parentbacd4128617e1dd613998c0268ded8304cef6f19 (diff)
downloadlibgphoto2-0dbeaf7cbf30ab88ac7aea3e7d3f24df8dc0309f.tar.gz
Use consistently named non-reserved CPP macros for header files
C preprocessor macros beginning/ending with underscores are reserved for system use as well as macros containing a double underscore anywhere, so application software macros are supposed to be named differently. For a header file gphoto2-abilities-list.h, this consistently uses a macro name LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H for the usual #ifndef LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H #define LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H ... content of the header file ... #endif /* !defined(LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H) */ Found using "clang -Weverything". This should work, unless when run with an ancient C preprocessor which might only the first 8 or 10 characters to distinguish macro names and ignores the remainder of the name.
Diffstat (limited to 'libgphoto2_port')
-rw-r--r--libgphoto2_port/gphoto2/gphoto2-port-info-list.h6
-rw-r--r--libgphoto2_port/gphoto2/gphoto2-port-library.h6
-rw-r--r--libgphoto2_port/gphoto2/gphoto2-port-log.h6
-rw-r--r--libgphoto2_port/gphoto2/gphoto2-port-portability.h8
-rw-r--r--libgphoto2_port/gphoto2/gphoto2-port-result.h6
-rw-r--r--libgphoto2_port/gphoto2/gphoto2-port-version.h6
-rw-r--r--libgphoto2_port/gphoto2/gphoto2-port.h6
-rw-r--r--libgphoto2_port/libgphoto2_port/gphoto2-port-info.h7
-rw-r--r--libgphoto2_port/vusb/vcamera.h6
9 files changed, 30 insertions, 27 deletions
diff --git a/libgphoto2_port/gphoto2/gphoto2-port-info-list.h b/libgphoto2_port/gphoto2/gphoto2-port-info-list.h
index e8c3b209a..9fe85a123 100644
--- a/libgphoto2_port/gphoto2/gphoto2-port-info-list.h
+++ b/libgphoto2_port/gphoto2/gphoto2-port-info-list.h
@@ -21,8 +21,8 @@
* Boston, MA 02110-1301 USA
*/
-#ifndef __GPHOTO2_PORT_INFO_LIST_H__
-#define __GPHOTO2_PORT_INFO_LIST_H__
+#ifndef LIBGPHOTO2_GPHOTO2_PORT_INFO_LIST_H
+#define LIBGPHOTO2_GPHOTO2_PORT_INFO_LIST_H
/**
* \brief The gphoto port type.
@@ -110,4 +110,4 @@ const char *gp_port_message_codeset (const char*);
}
#endif /* __cplusplus */
-#endif /* __GPHOTO2_PORT_INFO_LIST_H__ */
+#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_INFO_LIST_H) */
diff --git a/libgphoto2_port/gphoto2/gphoto2-port-library.h b/libgphoto2_port/gphoto2/gphoto2-port-library.h
index 2a9fd8839..be92ba305 100644
--- a/libgphoto2_port/gphoto2/gphoto2-port-library.h
+++ b/libgphoto2_port/gphoto2/gphoto2-port-library.h
@@ -21,8 +21,8 @@
* Boston, MA 02110-1301 USA
*/
-#ifndef __GPHOTO2_PORT_LIBRARY_H__
-#define __GPHOTO2_PORT_LIBRARY_H__
+#ifndef LIBGPHOTO2_GPHOTO2_PORT_LIBRARY_H
+#define LIBGPHOTO2_GPHOTO2_PORT_LIBRARY_H
#include <gphoto2/gphoto2-port-info-list.h>
#include <gphoto2/gphoto2-port.h>
@@ -100,4 +100,4 @@ int gp_port_library_list (GPPortInfoList *list);
GPPortOperations *gp_port_library_operations (void);
-#endif /* __GPHOTO2_PORT_LIBRARY_H__ */
+#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_LIBRARY_H) */
diff --git a/libgphoto2_port/gphoto2/gphoto2-port-log.h b/libgphoto2_port/gphoto2/gphoto2-port-log.h
index b4737577b..10cb49878 100644
--- a/libgphoto2_port/gphoto2/gphoto2-port-log.h
+++ b/libgphoto2_port/gphoto2/gphoto2-port-log.h
@@ -18,8 +18,8 @@
* Boston, MA 02110-1301 USA
*/
-#ifndef __GPHOTO2_PORT_LOG_H__
-#define __GPHOTO2_PORT_LOG_H__
+#ifndef LIBGPHOTO2_GPHOTO2_PORT_LOG_H
+#define LIBGPHOTO2_GPHOTO2_PORT_LOG_H
#include <stdarg.h>
@@ -237,4 +237,4 @@ __attribute__((__format__(printf,4,5)))
#endif /* _GPHOTO2_INTERNAL_CODE */
-#endif /* __GPHOTO2_PORT_LOG_H__ */
+#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_LOG_H) */
diff --git a/libgphoto2_port/gphoto2/gphoto2-port-portability.h b/libgphoto2_port/gphoto2/gphoto2-port-portability.h
index 4f963b025..b8b183573 100644
--- a/libgphoto2_port/gphoto2/gphoto2-port-portability.h
+++ b/libgphoto2_port/gphoto2/gphoto2-port-portability.h
@@ -17,8 +17,9 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
-#ifndef __GPHOTO2_PORT_PORTABILITY_H__
-#define __GPHOTO2_PORT_PORTABILITY_H__
+
+#ifndef LIBGPHOTO2_GPHOTO2_PORT_PORTABILITY_H
+#define LIBGPHOTO2_GPHOTO2_PORT_PORTABILITY_H
#ifdef _GPHOTO2_INTERNAL_CODE
@@ -141,5 +142,6 @@ int gp_system_is_dir (const char *dirname);
************************************************************************/
#endif /* _GPHOTO2_INTERNAL_CODE */
-#endif /* ifndef __GPHOTO2_PORT_PORTABILITY_H__ */
+#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_PORTABILITY_H) */
+
/* end of file */
diff --git a/libgphoto2_port/gphoto2/gphoto2-port-result.h b/libgphoto2_port/gphoto2/gphoto2-port-result.h
index 4fefa7a31..9fab744e6 100644
--- a/libgphoto2_port/gphoto2/gphoto2-port-result.h
+++ b/libgphoto2_port/gphoto2/gphoto2-port-result.h
@@ -18,8 +18,8 @@
* Boston, MA 02110-1301 USA
*/
-#ifndef __GPHOTO2_PORT_RESULT_H__
-#define __GPHOTO2_PORT_RESULT_H__
+#ifndef LIBGPHOTO2_GPHOTO2_PORT_RESULT_H
+#define LIBGPHOTO2_GPHOTO2_PORT_RESULT_H
/* Return values. gphoto2-port should only return values from 0 to -99 */
/**
@@ -129,5 +129,5 @@ const char *gp_port_result_as_string (int result);
}
#endif /* __cplusplus */
-#endif /* __GPHOTO2_PORT_RESULT_H__ */
+#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_RESULT_H) */
diff --git a/libgphoto2_port/gphoto2/gphoto2-port-version.h b/libgphoto2_port/gphoto2/gphoto2-port-version.h
index 761f56208..3a11e7928 100644
--- a/libgphoto2_port/gphoto2/gphoto2-port-version.h
+++ b/libgphoto2_port/gphoto2/gphoto2-port-version.h
@@ -18,8 +18,8 @@
* Boston, MA 02110-1301 USA
*/
-#ifndef __GPHOTO2_PORT_VERSION_H__
-#define __GPHOTO2_PORT_VERSION_H__
+#ifndef LIBGPHOTO2_GPHOTO2_PORT_VERSION_H
+#define LIBGPHOTO2_GPHOTO2_PORT_VERSION_H
typedef enum {
GP_VERSION_SHORT = 0,
@@ -38,7 +38,7 @@ const char **gp_port_library_version(GPVersionVerbosity verbose);
}
#endif
-#endif /* __GPHOTO2_PORT_VERSION_H__ */
+#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_VERSION_H) */
/*
* Local Variables:
diff --git a/libgphoto2_port/gphoto2/gphoto2-port.h b/libgphoto2_port/gphoto2/gphoto2-port.h
index 7e5c67d99..6e734ea33 100644
--- a/libgphoto2_port/gphoto2/gphoto2-port.h
+++ b/libgphoto2_port/gphoto2/gphoto2-port.h
@@ -21,8 +21,8 @@
* Boston, MA 02110-1301 USA
*/
-#ifndef __GPHOTO2_PORT_H__
-#define __GPHOTO2_PORT_H__
+#ifndef LIBGPHOTO2_GPHOTO2_PORT_H
+#define LIBGPHOTO2_GPHOTO2_PORT_H
#include <gphoto2/gphoto2-port-info-list.h>
@@ -245,4 +245,4 @@ typedef GPPortSettings gp_port_settings;
}
#endif /* __cplusplus */
-#endif /* __GPHOTO2_PORT_H__ */
+#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_H) */
diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port-info.h b/libgphoto2_port/libgphoto2_port/gphoto2-port-info.h
index 720e0c8dd..b7864c305 100644
--- a/libgphoto2_port/libgphoto2_port/gphoto2-port-info.h
+++ b/libgphoto2_port/libgphoto2_port/gphoto2-port-info.h
@@ -21,8 +21,8 @@
* Boston, MA 02110-1301 USA
*/
-#ifndef GPHOTO_PORT_INFO_H
-#define GPHOTO_PORT_INFO_H
+#ifndef LIBGPHOTO2_GPHOTO2_PORT_INFO_H
+#define LIBGPHOTO2_GPHOTO2_PORT_INFO_H
/**
* \internal GPPortInfo:
@@ -37,4 +37,5 @@ struct _GPPortInfo {
/* Private */
char *library_filename; /**< \brief Internal pathname of the port driver. Do not use outside of the port library. */
};
-#endif
+
+#endif /* !defined(LIBGPHOTO2_GPHOTO2_PORT_INFO_H) */
diff --git a/libgphoto2_port/vusb/vcamera.h b/libgphoto2_port/vusb/vcamera.h
index db8426fd6..e15a27f61 100644
--- a/libgphoto2_port/vusb/vcamera.h
+++ b/libgphoto2_port/vusb/vcamera.h
@@ -19,8 +19,8 @@
* Boston, MA 02110-1301 USA
*/
-#ifndef __VCAMERA_H__
-#define __VCAMERA_H__
+#ifndef IOLIBS_VUSB_VCAMERA_H
+#define IOLIBS_VUSB_VCAMERA_H
#undef FUZZ_PTP
@@ -76,4 +76,4 @@ typedef struct vcamera {
vcamera *vcamera_new(vcameratype);
-#endif
+#endif /* !defined(IOLIBS_VUSB_VCAMERA_H) */