Skip to contentSkip to conversation

kset.h, tar.h: add missing header guard to prevent multiple inclusion

PATCH In review Elia Pinto 2 participants 2 messages Nov 7, 2019

lore
Share & tools
lore

Elia Pinto

author
#0 lore raw

PATCH 1/1 kset.h, tar.h: add missing header guard to prevent multiple inclusion

Add missing headers to prevent ill-effects from multiple inclusion.

Found by the LGTM source code analyzer.

---
 kwset.h | 4 ++++
 tar.h   | 5 +++++
 2 files changed, 9 insertions(+)
kwset.h +4 -0
index df99a92178..f50ecae573 100644
@@ -1,3 +1,6 @@
+#ifndef KWSET_H
+#define KWSET_H
+
 /* This file has been copied from commit e7ac713d^ in the GNU grep git
  * repository. A few small changes have been made to adapt the code to
  * Git.
@@ -59,3 +62,4 @@ size_t kwsexec(kwset_t, char const *, size_t, struct kwsmatch *);
 /* Deallocate the given keyword set and all its associated storage. */
 void kwsfree(kwset_t);
 
+#endif /* KWSET_H */
tar.h +5 -0
index 3467705e9b..6b258c4d4a 100644
@@ -1,3 +1,6 @@
+#ifndef TAR_H
+#define TAR_H
+
 #define TYPEFLAG_AUTO		'\0'
 #define TYPEFLAG_REG		'0'
 #define TYPEFLAG_LNK		'2'
@@ -23,3 +26,5 @@ struct ustar_header {
 	char devminor[8];	/* 337 */
 	char prefix[155];	/* 345 */
 };
+
+#endif /* TAR_H */
Signature · 1 line
2.24.0.rc0.467.g566ccdd3e4.dirty
#1 lore raw
Quoted 9 lines · Elia Pinto

Add missing headers to prevent ill-effects from multiple inclusion.

Found by the LGTM source code analyzer.

---
 kwset.h | 4 ++++
 tar.h   | 5 +++++
 2 files changed, 9 insertions(+)

Makes sense; thanks.

Quoted 33 lines
kwset.h +4 -0
index df99a92178..f50ecae573 100644
@@ -1,3 +1,6 @@
+#ifndef KWSET_H
+#define KWSET_H
+
 /* This file has been copied from commit e7ac713d^ in the GNU grep git
  * repository. A few small changes have been made to adapt the code to
  * Git.
@@ -59,3 +62,4 @@ size_t kwsexec(kwset_t, char const *, size_t, struct kwsmatch *);
 /* Deallocate the given keyword set and all its associated storage. */
 void kwsfree(kwset_t);
 
+#endif /* KWSET_H */
tar.h +5 -0
index 3467705e9b..6b258c4d4a 100644
@@ -1,3 +1,6 @@
+#ifndef TAR_H
+#define TAR_H
+
 #define TYPEFLAG_AUTO		'\0'
 #define TYPEFLAG_REG		'0'
 #define TYPEFLAG_LNK		'2'
@@ -23,3 +26,5 @@ struct ustar_header {
 	char devminor[8];	/* 337 */
 	char prefix[155];	/* 345 */
 };
+
+#endif /* TAR_H */