summaryrefslogtreecommitdiff
path: root/libgphoto2_port
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2021-10-07 01:03:42 +0200
committerMarcus Meissner <meissner@suse.de>2021-10-11 09:20:50 +0200
commit767ee8bad421f7317718a1c6f138fb32d8432a7c (patch)
treeed207bdcbdea3ff25d405559034838121022d6e8 /libgphoto2_port
parent6e2779554662e37a1e53570e590c818ad99a96d9 (diff)
downloadlibgphoto2-767ee8bad421f7317718a1c6f138fb32d8432a7c.tar.gz
Avoid accidental include file name collisions
There are five libgphoto2 internal *.h include files inside the source tree's `libgphoto2/` folder. Internal means they are part of the libgphoto2 implementation, and are not part of the public libgphoto2 API or ABI. These files have names which are so generic that it is difficult to see from a `#include` statement that the included file is actually part of libgphoto2: bayer-types.h bayer.h exif.h gamma.h jpeg.h While building, an additional file is created inside the `libgphoto2/` folder with a name which does hint to its relationship with libgphoto2: gphoto2-endian.h To reduce the probability of accidental conflicts with include files which might also be called the same very generic name, this changes the use of these include files to a preprocessor directive like #include "libgphoto2/bayer.h> instead of #include "bayer.h" To enforce the need for the "libgphoto2/" part in the #include preprocessor directive, this also removes the respective `-I` arguments for the `libgphoto2` subdir (both in source tree and in build tree) from `*_CPPFLAGS`. This change was inspired by `libgphoto2/` and `camlibs/stv0680/` containing very different include files both called `bayer.h`.
Diffstat (limited to 'libgphoto2_port')
-rw-r--r--libgphoto2_port/libgphoto2_port/Makefile.am5
-rw-r--r--libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c2
-rw-r--r--libgphoto2_port/libgphoto2_port/gphoto2-port.c2
3 files changed, 5 insertions, 4 deletions
diff --git a/libgphoto2_port/libgphoto2_port/Makefile.am b/libgphoto2_port/libgphoto2_port/Makefile.am
index 70fd0fdf5..981a73b30 100644
--- a/libgphoto2_port/libgphoto2_port/Makefile.am
+++ b/libgphoto2_port/libgphoto2_port/Makefile.am
@@ -1,9 +1,10 @@
lib_LTLIBRARIES = libgphoto2_port.la
libgphoto2_port_la_CPPFLAGS = \
- -I$(srcdir) -I$(top_srcdir) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/libgphoto2_port \
$(AM_CPPFLAGS) $(CPPFLAGS) \
- $(LTDLINCL)
+ $(LTDLINCL)
# Notes about the list of exported symbols:
# gp_* also contains internal symbols which are intended for
diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c
index 7c5acd6b7..41775d814 100644
--- a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c
+++ b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c
@@ -44,7 +44,7 @@
#include <gphoto2/gphoto2-port-library.h>
#include <gphoto2/gphoto2-port-log.h>
-#include "gphoto2-port-info.h"
+#include "libgphoto2_port/gphoto2-port-info.h"
#ifdef ENABLE_NLS
# include <libintl.h>
diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port.c b/libgphoto2_port/libgphoto2_port/gphoto2-port.c
index 71c9d4e21..9687e7ffe 100644
--- a/libgphoto2_port/libgphoto2_port/gphoto2-port.c
+++ b/libgphoto2_port/libgphoto2_port/gphoto2-port.c
@@ -38,7 +38,7 @@
#include <gphoto2/gphoto2-port-library.h>
#include <gphoto2/gphoto2-port-log.h>
-#include "gphoto2-port-info.h"
+#include "libgphoto2_port/gphoto2-port-info.h"
#ifdef ENABLE_NLS
# include <libintl.h>