[2589] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[PATCH] Sanitize our include guards somewhat

daemon@ATHENA.MIT.EDU (David Benjamin)
Sat Aug 7 19:39:15 2010

From: David Benjamin <davidben@MIT.EDU>
To: barnowl-dev@mit.edu
Date: Sat,  7 Aug 2010 16:38:55 -0700

Avoid double underscores to avoid clashing with reserved symbols. Also
adding BARNOWL to guard names. While I'm at it, owl_prototypes.h could
use guards.
---
 codelist.pl  |    6 ++++--
 filterproc.h |    6 +++---
 owl.h        |    6 +++---
 owl_perl.h   |    6 +++---
 window.h     |    6 +++---
 5 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/codelist.pl b/codelist.pl
index 984fcd4..ce6fb6e 100755
--- a/codelist.pl
+++ b/codelist.pl
@@ -1,5 +1,8 @@
 #! /usr/bin/perl
 
+my $guard_symbol = "INC_BARNOWL_OWL_PROTOTYPES_H";
+print "#ifndef $guard_symbol\n";
+print "#define $guard_symbol\n";
 foreach $file (@ARGV) {
     open(FILE, $file);
 
@@ -30,5 +33,4 @@ foreach $file (@ARGV) {
     close(FILE);
     print "\n";
 }
-
-
+print "#endif /* $guard_symbol */\n";
diff --git a/filterproc.h b/filterproc.h
index 75ede64..239a0c8 100644
--- a/filterproc.h
+++ b/filterproc.h
@@ -1,9 +1,9 @@
-#ifndef __FILTER_PROC_H__
-#define __FILTER_PROC_H__
+#ifndef INC_BARNOWL_FILTER_PROC_H
+#define INC_BARNOWL_FILTER_PROC_H
 
 int call_filter(const char *prog,
                 const char *const *argv,
                 const char *in,
                 char **out, int *status);
 
-#endif
+#endif /* INC_BARNOWL_FILTER_PROC_H */
diff --git a/owl.h b/owl.h
index 14875d8..a3c9666 100644
--- a/owl.h
+++ b/owl.h
@@ -6,8 +6,8 @@
  *  file included with the distribution for more information.
  */
 
-#ifndef INC_OWL_H
-#define INC_OWL_H
+#ifndef INC_BARNOWL_OWL_H
+#define INC_BARNOWL_OWL_H
 
 #ifdef HAVE_STDBOOL_H
 #include <stdbool.h>
@@ -658,4 +658,4 @@ int ZGetSubscriptions(ZSubscription_t *, int *);
 int ZGetLocations(ZLocations_t *,int *);
 #endif
 
-#endif /* INC_OWL_H */
+#endif /* INC_BARNOWL_OWL_H */
diff --git a/owl_perl.h b/owl_perl.h
index 65981b7..67f9377 100644
--- a/owl_perl.h
+++ b/owl_perl.h
@@ -1,5 +1,5 @@
-#ifndef INC_OWL_PERL_H
-#define INC_OWL_PERL_H
+#ifndef INC_BARNOWL_OWL_PERL_H
+#define INC_BARNOWL_OWL_PERL_H
 
 #define OWL_PERL_VOID_CALL (void)POPs;
 
@@ -52,4 +52,4 @@
     LEAVE; \
 }
 
-#endif /* INC_PERL_PERL_H */
+#endif /* INC_BARNOWL_OWL_PERL_H */
diff --git a/window.h b/window.h
index dc45825..2293d88 100644
--- a/window.h
+++ b/window.h
@@ -1,5 +1,5 @@
-#ifndef __BARNOWL_WINDOW_H__
-#define __BARNOWL_WINDOW_H__
+#ifndef INC_BARNOWL_WINDOW_H
+#define INC_BARNOWL_WINDOW_H
 
 #include <glib.h>
 #include <glib-object.h>
@@ -66,4 +66,4 @@ void owl_window_fill_parent_cb(owl_window *parent, void *user_data);
 
 G_END_DECLS
 
-#endif /* __BARNOWL_WINDOW_H__ */
+#endif /* INC_BARNOWL_WINDOW_H */
-- 
1.7.2.1.45.gb1c4


home help back first fref pref prev next nref lref last post