summaryrefslogtreecommitdiff
path: root/camlibs/canon
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 /camlibs/canon
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 'camlibs/canon')
-rw-r--r--camlibs/canon/canon.h6
-rw-r--r--camlibs/canon/crc.h6
-rw-r--r--camlibs/canon/library.h6
-rw-r--r--camlibs/canon/serial.h6
-rw-r--r--camlibs/canon/usb.h7
-rw-r--r--camlibs/canon/util.h6
6 files changed, 19 insertions, 18 deletions
diff --git a/camlibs/canon/canon.h b/camlibs/canon/canon.h
index 06cec2b3f..1bd41bdb2 100644
--- a/camlibs/canon/canon.h
+++ b/camlibs/canon/canon.h
@@ -5,8 +5,8 @@
*
*/
-#ifndef _CANON_H
-#define _CANON_H
+#ifndef CAMLIBS_CANON_CANON_H
+#define CAMLIBS_CANON_CANON_H
#ifdef CANON_EXPERIMENTAL_UPLOAD
# ifdef __GCC__
@@ -738,7 +738,7 @@ int canon_int_extract_jpeg_thumb (unsigned char *data, const unsigned int datale
/* for the macros abbreviating gp_log* */
#define GP_MODULE "canon"
-#endif /* _CANON_H */
+#endif /* !defined(CAMLIBS_CANON_CANON_H) */
/*
* Local Variables:
diff --git a/camlibs/canon/crc.h b/camlibs/canon/crc.h
index 0e786ca8e..3c83183ca 100644
--- a/camlibs/canon/crc.h
+++ b/camlibs/canon/crc.h
@@ -1,7 +1,7 @@
-#ifndef CRC_H
-#define CRC_H
+#ifndef CAMLIBS_CANON_CRC_H
+#define CAMLIBS_CANON_CRC_H
int canon_psa50_gen_crc(const unsigned char *pkt, int len);
int canon_psa50_chk_crc(const unsigned char *pkt, int len, unsigned short crc);
-#endif
+#endif /* !defined(CAMLIBS_CANON_CRC_H) */
diff --git a/camlibs/canon/library.h b/camlibs/canon/library.h
index 794313c9c..477ae6928 100644
--- a/camlibs/canon/library.h
+++ b/camlibs/canon/library.h
@@ -4,8 +4,8 @@
*
****************************************************************************/
-#ifndef _LIBRARY_H
-#define _LIBRARY_H
+#ifndef CAMLIBS_CANON_LIBRARY_H
+#define CAMLIBS_CANON_LIBRARY_H
/****************************************************************************
*
@@ -29,7 +29,7 @@ void clear_readiness(Camera *camera);
#define GP_MODULE "canon"
-#endif /* _LIBRARY_H */
+#endif /* !defined(CAMLIBS_CANON_LIBRARY_H) */
/****************************************************************************
*
diff --git a/camlibs/canon/serial.h b/camlibs/canon/serial.h
index b4daaeed8..318a1b5cd 100644
--- a/camlibs/canon/serial.h
+++ b/camlibs/canon/serial.h
@@ -4,8 +4,8 @@
*
****************************************************************************/
-#ifndef _SERIAL_H
-#define _SERIAL_H
+#ifndef CAMLIBS_CANON_SERIAL_H
+#define CAMLIBS_CANON_SERIAL_H
/****************************************************************************
*
@@ -312,7 +312,7 @@ typedef enum {
-#endif /* _SERIAL_H */
+#endif /* !defined(CAMLIBS_CANON_SERIAL_H) */
/****************************************************************************
*
diff --git a/camlibs/canon/usb.h b/camlibs/canon/usb.h
index 764b13737..19e559f04 100644
--- a/camlibs/canon/usb.h
+++ b/camlibs/canon/usb.h
@@ -4,8 +4,8 @@
*
****************************************************************************/
-#ifndef _CANON_USB_H
-#define _CANON_USB_H
+#ifndef CAMLIBS_CANON_USB_H
+#define CAMLIBS_CANON_USB_H
/**
* USB_BULK_READ_SIZE
@@ -282,7 +282,8 @@ int canon_usb_ready (Camera *camera, GPContext *context);
int canon_usb_wait_for_event (Camera *camera, int timeout,
CameraEventType *eventtype, void **eventdata,
GPContext *context);
-#endif /* _CANON_USB_H */
+
+#endif /* !defined(CAMLIBS_CANON_USB_H) */
/****************************************************************************
*
diff --git a/camlibs/canon/util.h b/camlibs/canon/util.h
index f95ccbab9..3439b47f0 100644
--- a/camlibs/canon/util.h
+++ b/camlibs/canon/util.h
@@ -4,8 +4,8 @@
*
****************************************************************************/
-#ifndef _CANON_UTIL_H
-#define _CANON_UTIL_H
+#ifndef CAMLIBS_CANON_UTIL_H
+#define CAMLIBS_CANON_UTIL_H
#include "gphoto2-endian.h"
@@ -33,7 +33,7 @@ int is_cr2 (const char *name);
const char *filename2mimetype(const char *filename);
-#endif /* _CANON_UTIL_H */
+#endif /* !defined(CAMLIBS_CANON_UTIL_H) */
/****************************************************************************
*