From 0dbeaf7cbf30ab88ac7aea3e7d3f24df8dc0309f Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 5 Oct 2021 15:50:32 +0200 Subject: 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. --- libgphoto2/bayer.h | 6 +++--- libgphoto2/exif.h | 6 +++--- libgphoto2/gamma.h | 6 +++--- libgphoto2/jpeg.h | 7 ++++--- 4 files changed, 13 insertions(+), 12 deletions(-) (limited to 'libgphoto2') diff --git a/libgphoto2/bayer.h b/libgphoto2/bayer.h index f406ea6a4..0b5bd1e4d 100644 --- a/libgphoto2/bayer.h +++ b/libgphoto2/bayer.h @@ -21,8 +21,8 @@ * Boston, MA 02110-1301 USA */ -#ifndef __BAYER_H__ -#define __BAYER_H__ +#ifndef LIBGPHOTO2_BAYER_H +#define LIBGPHOTO2_BAYER_H /** * \brief how the bayer CCD array is laid out @@ -58,4 +58,4 @@ int gp_ahd_decode (unsigned char *input, int w, int h, unsigned char *output, BayerTile tile); int gp_ahd_interpolate (unsigned char *image, int w, int h, BayerTile tile); -#endif /* __BAYER_H__ */ +#endif /* !defined(LIBGPHOTO2_BAYER_H) */ diff --git a/libgphoto2/exif.h b/libgphoto2/exif.h index 9032f5201..a5dd2ec8c 100644 --- a/libgphoto2/exif.h +++ b/libgphoto2/exif.h @@ -9,8 +9,8 @@ * In the future, vendor-proprietary exif extensions might be supported. */ -#ifndef _gphoto_exif_ -#define _gphoto_exif_ +#ifndef LIBGPHOTO2_EXIF_H +#define LIBGPHOTO2_EXIF_H /* * Not used anymore, use libexif if necessary. @@ -23,4 +23,4 @@ unsigned char *gpi_exif_get_thumbnail_and_size(void *exifdat, long *size); int gpi_exif_stat(void *exifdata); -#endif /* _gphoto_exif_ */ +#endif /* !defined(LIBGPHOTO2_EXIF_H) */ diff --git a/libgphoto2/gamma.h b/libgphoto2/gamma.h index 0d963cbf1..7a6834ea1 100644 --- a/libgphoto2/gamma.h +++ b/libgphoto2/gamma.h @@ -21,11 +21,11 @@ * Boston, MA 02110-1301 USA */ -#ifndef __GAMMA_H__ -#define __GAMMA_H__ +#ifndef LIBGPHOTO2_GAMMA_H +#define LIBGPHOTO2_GAMMA_H int gp_gamma_fill_table (unsigned char *table, double g); int gp_gamma_correct_single (unsigned char *table, unsigned char *data, unsigned int data_size); -#endif /* __GAMMA_H__ */ +#endif /* !defined(LIBGPHOTO2_GAMMA_H) */ diff --git a/libgphoto2/jpeg.h b/libgphoto2/jpeg.h index 71355e190..2751b6876 100644 --- a/libgphoto2/jpeg.h +++ b/libgphoto2/jpeg.h @@ -21,8 +21,8 @@ * Boston, MA 02110-1301 USA */ -#ifndef __GPHOTO2_JPEG_H__ -#define __GPHOTO2_JPEG_H__ +#ifndef LIBGPHOTO2_JPEG_H +#define LIBGPHOTO2_JPEG_H #include @@ -78,4 +78,5 @@ jpeg *gpi_jpeg_header(int width, int height, chunk *huff1, chunk *huff2, chunk *huff3, chunk *huff4); char gpi_jpeg_write(CameraFile *file, const char *name, jpeg *myjpeg); -#endif + +#endif /* !defined(LIBGPHOTO2_JPEG_H) */ -- cgit v1.2.1