From f11ec7ba8a2c5f90d12249f1e571464e646e7784 Mon Sep 17 00:00:00 2001
From: Anders Blomdell <anders.blomdell@control.lth.se>
Date: Tue, 24 Feb 2015 10:45:01 +0100
Subject: [PATCH] Guard macro unification/cleanup

---
 lib/c/2006/labcomm2006.h                       | 6 +++---
 lib/c/2006/labcomm2006_default_error_handler.h | 4 ++++
 lib/c/2006/labcomm2006_default_memory.h        | 3 +++
 lib/c/2006/labcomm2006_default_scheduler.h     | 4 ++++
 lib/c/2006/labcomm2006_dynamic_buffer_writer.h | 4 ++--
 lib/c/2006/labcomm2006_error.h                 | 4 ++--
 lib/c/2006/labcomm2006_fd_reader.h             | 5 +++--
 lib/c/2006/labcomm2006_fd_writer.h             | 4 ++--
 lib/c/2006/labcomm2006_ioctl.h                 | 4 ++--
 lib/c/2006/labcomm2006_private.h               | 4 ++--
 lib/c/2006/labcomm2006_pthread_scheduler.h     | 4 ++--
 lib/c/2006/labcomm2006_scheduler.h             | 4 ++--
 lib/c/2006/labcomm2006_scheduler_private.h     | 4 ++--
 lib/c/2006/labcomm_compat_vxworks.h            | 4 ++--
 lib/c/2014/labcomm.h                           | 4 ++--
 lib/c/2014/labcomm_default_error_handler.h     | 4 ++++
 lib/c/2014/labcomm_default_memory.h            | 3 +++
 lib/c/2014/labcomm_default_scheduler.h         | 4 ++++
 lib/c/2014/labcomm_dynamic_buffer_writer.h     | 4 ++--
 lib/c/2014/labcomm_error.h                     | 4 ++--
 lib/c/2014/labcomm_fd_reader.h                 | 4 ++--
 lib/c/2014/labcomm_fd_writer.h                 | 4 ++--
 lib/c/2014/labcomm_ioctl.h                     | 4 ++--
 lib/c/2014/labcomm_private.h                   | 4 ++--
 lib/c/2014/labcomm_pthread_scheduler.h         | 4 ++--
 lib/c/2014/labcomm_scheduler.h                 | 4 ++--
 lib/c/2014/labcomm_scheduler_private.h         | 4 ++--
 lib/c/version_compare.py                       | 4 ++--
 28 files changed, 68 insertions(+), 45 deletions(-)

diff --git a/lib/c/2006/labcomm2006.h b/lib/c/2006/labcomm2006.h
index 1ea5aae..9958b17 100644
--- a/lib/c/2006/labcomm2006.h
+++ b/lib/c/2006/labcomm2006.h
@@ -1,5 +1,5 @@
 /*
-  labcomm.h -- user interface for handling encoding and decoding of
+  labcomm2006.h -- user interface for handling encoding and decoding of
                labcomm samples.
 
   Copyright 2006-2013 Anders Blomdell <anders.blomdell@control.lth.se>
@@ -20,8 +20,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_H_
-#define _LABCOMM_H_
+#ifndef __LABCOMM2006_H__
+#define __LABCOMM2006_H__
 
 #include <stdarg.h>
 
diff --git a/lib/c/2006/labcomm2006_default_error_handler.h b/lib/c/2006/labcomm2006_default_error_handler.h
index b8254f8..b00d988 100644
--- a/lib/c/2006/labcomm2006_default_error_handler.h
+++ b/lib/c/2006/labcomm2006_default_error_handler.h
@@ -18,7 +18,11 @@
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+#ifndef __LABCOMM2006_DEFAULT_ERROR_HANDLER_H__
+#define __LABCOMM2006_DEFAULT_ERROR_HANDLER_H__
 
 #include "labcomm2006.h"
 
 extern struct labcomm2006_error_handler *labcomm2006_default_error_handler;
+
+#endif
diff --git a/lib/c/2006/labcomm2006_default_memory.h b/lib/c/2006/labcomm2006_default_memory.h
index 4f46f42..ba36988 100644
--- a/lib/c/2006/labcomm2006_default_memory.h
+++ b/lib/c/2006/labcomm2006_default_memory.h
@@ -18,9 +18,12 @@
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+#ifndef __LABCOMM2006_DEFAULT_MEMORY_H__
+#define __LABCOMM2006_DEFAULT_MEMORY_H__
 
 #include <stdlib.h>
 #include "labcomm2006.h"
 
 extern struct labcomm2006_memory *labcomm2006_default_memory;
 
+#endif
diff --git a/lib/c/2006/labcomm2006_default_scheduler.h b/lib/c/2006/labcomm2006_default_scheduler.h
index bd271f0..becd936 100644
--- a/lib/c/2006/labcomm2006_default_scheduler.h
+++ b/lib/c/2006/labcomm2006_default_scheduler.h
@@ -18,7 +18,11 @@
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+#ifndef __LABCOMM2006_DEFAULT_SCHEDULER_H__
+#define __LABCOMM2006_DEFAULT_SCHEDULER_H__
 
 #include "labcomm2006.h"
 
 extern struct labcomm2006_scheduler *labcomm2006_default_scheduler;
+
+#endif
diff --git a/lib/c/2006/labcomm2006_dynamic_buffer_writer.h b/lib/c/2006/labcomm2006_dynamic_buffer_writer.h
index c0ab9d0..3611640 100644
--- a/lib/c/2006/labcomm2006_dynamic_buffer_writer.h
+++ b/lib/c/2006/labcomm2006_dynamic_buffer_writer.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_DYNAMIC_BUFFER_READER_WRITER_H_
-#define _LABCOMM_DYNAMIC_BUFFER_READER_WRITER_H_
+#ifndef __LABCOMM2006_DYNAMIC_BUFFER_READER_WRITER_H__
+#define __LABCOMM2006_DYNAMIC_BUFFER_READER_WRITER_H__
 
 #include "labcomm2006.h"
 
diff --git a/lib/c/2006/labcomm2006_error.h b/lib/c/2006/labcomm2006_error.h
index 27a0e72..9c257b9 100644
--- a/lib/c/2006/labcomm2006_error.h
+++ b/lib/c/2006/labcomm2006_error.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef __LABCOMM_ERROR_H__
-#define __LABCOMM_ERROR_H__
+#ifndef __LABCOMM2006_ERROR_H__
+#define __LABCOMM2006_ERROR_H__
 
 enum labcomm2006_error {
 #define LABCOMM_ERROR(name, description) name ,
diff --git a/lib/c/2006/labcomm2006_fd_reader.h b/lib/c/2006/labcomm2006_fd_reader.h
index 066ac81..408bf9f 100644
--- a/lib/c/2006/labcomm2006_fd_reader.h
+++ b/lib/c/2006/labcomm2006_fd_reader.h
@@ -1,3 +1,4 @@
+
 /*
   labcomm2006_fd_reader.c -- a reader for unix style file-descriptors
 
@@ -19,8 +20,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_FD_READER_H_
-#define _LABCOMM_FD_READER_H_
+#ifndef __LABCOMM2006_FD_READER_H__
+#define __LABCOMM2006_FD_READER_H__
 
 #include "labcomm2006.h"
 
diff --git a/lib/c/2006/labcomm2006_fd_writer.h b/lib/c/2006/labcomm2006_fd_writer.h
index 56fda84..8df9d08 100644
--- a/lib/c/2006/labcomm2006_fd_writer.h
+++ b/lib/c/2006/labcomm2006_fd_writer.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_FD_WRITER_H_
-#define _LABCOMM_FD_WRITER_H_
+#ifndef __LABCOMM2006_FD_WRITER_H__
+#define __LABCOMM2006_FD_WRITER_H__
 
 #include "labcomm2006.h"
 
diff --git a/lib/c/2006/labcomm2006_ioctl.h b/lib/c/2006/labcomm2006_ioctl.h
index 47b48dd..3fabcd2 100644
--- a/lib/c/2006/labcomm2006_ioctl.h
+++ b/lib/c/2006/labcomm2006_ioctl.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef __LABCOMM_IOCTL_H__
-#define __LABCOMM_IOCTL_H__
+#ifndef __LABCOMM2006_IOCTL_H__
+#define __LABCOMM2006_IOCTL_H__
 
 #include "labcomm2006.h"
 
diff --git a/lib/c/2006/labcomm2006_private.h b/lib/c/2006/labcomm2006_private.h
index 378719c..efa095f 100644
--- a/lib/c/2006/labcomm2006_private.h
+++ b/lib/c/2006/labcomm2006_private.h
@@ -20,8 +20,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_PRIVATE_H_
-#define _LABCOMM_PRIVATE_H_
+#ifndef __LABCOMM2006_PRIVATE_H__
+#define __LABCOMM2006_PRIVATE_H__
 
 #ifdef LABCOMM_COMPAT
   #include LABCOMM_COMPAT
diff --git a/lib/c/2006/labcomm2006_pthread_scheduler.h b/lib/c/2006/labcomm2006_pthread_scheduler.h
index 101cfde..ab22b21 100644
--- a/lib/c/2006/labcomm2006_pthread_scheduler.h
+++ b/lib/c/2006/labcomm2006_pthread_scheduler.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_PTHREAD_SCHEDULER_H_
-#define _LABCOMM_PTHREAD_SCHEDULER_H_
+#ifndef __LABCOMM2006_PTHREAD_SCHEDULER_H__
+#define __LABCOMM2006_PTHREAD_SCHEDULER_H__
 
 #include "labcomm2006.h"
 
diff --git a/lib/c/2006/labcomm2006_scheduler.h b/lib/c/2006/labcomm2006_scheduler.h
index d4ea80d..0c332c1 100644
--- a/lib/c/2006/labcomm2006_scheduler.h
+++ b/lib/c/2006/labcomm2006_scheduler.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_SCHEDULER_H_
-#define _LABCOMM_SCHEDULER_H_
+#ifndef __LABCOMM2006_SCHEDULER_H__
+#define __LABCOMM2006_SCHEDULER_H__
 
 #ifdef LABCOMM_COMPAT
   #include LABCOMM_COMPAT
diff --git a/lib/c/2006/labcomm2006_scheduler_private.h b/lib/c/2006/labcomm2006_scheduler_private.h
index 1c80b36..f6f9555 100644
--- a/lib/c/2006/labcomm2006_scheduler_private.h
+++ b/lib/c/2006/labcomm2006_scheduler_private.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_SCHEDULER_PRIVATE_H_
-#define _LABCOMM_SCHEDULER_PRIVATE_H_
+#ifndef __LABCOMM2006_SCHEDULER_PRIVATE_H__
+#define __LABCOMM2006_SCHEDULER_PRIVATE_H__
 
 #ifdef LABCOMM_COMPAT
  #include LABCOMM_COMPAT
diff --git a/lib/c/2006/labcomm_compat_vxworks.h b/lib/c/2006/labcomm_compat_vxworks.h
index ca3b099..2918567 100644
--- a/lib/c/2006/labcomm_compat_vxworks.h
+++ b/lib/c/2006/labcomm_compat_vxworks.h
@@ -1,5 +1,5 @@
-#ifndef _LABCOMM2006_COMPAT_VXWORKS_H_
-#define _LABCOMM2006_COMPAT_VXWORKS_H_
+#ifndef __LABCOMM2006_COMPAT_VXWORKS_H__
+#define __LABCOMM2006_COMPAT_VXWORKS_H__
 
 #ifndef __VXWORKS__
 #error "__VXWORKS__" not defined
diff --git a/lib/c/2014/labcomm.h b/lib/c/2014/labcomm.h
index dd8859e..fa62e7d 100644
--- a/lib/c/2014/labcomm.h
+++ b/lib/c/2014/labcomm.h
@@ -20,8 +20,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_H_
-#define _LABCOMM_H_
+#ifndef __LABCOMM_H__
+#define __LABCOMM_H__
 
 #include <stdarg.h>
 
diff --git a/lib/c/2014/labcomm_default_error_handler.h b/lib/c/2014/labcomm_default_error_handler.h
index 4cd642a..8f479a0 100644
--- a/lib/c/2014/labcomm_default_error_handler.h
+++ b/lib/c/2014/labcomm_default_error_handler.h
@@ -18,7 +18,11 @@
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+#ifndef __LABCOMM_DEFAULT_ERROR_HANDLER_H__
+#define __LABCOMM_DEFAULT_ERROR_HANDLER_H__
 
 #include "labcomm.h"
 
 extern struct labcomm_error_handler *labcomm_default_error_handler;
+
+#endif
diff --git a/lib/c/2014/labcomm_default_memory.h b/lib/c/2014/labcomm_default_memory.h
index 8b22301..f00b226 100644
--- a/lib/c/2014/labcomm_default_memory.h
+++ b/lib/c/2014/labcomm_default_memory.h
@@ -18,9 +18,12 @@
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+#ifndef __LABCOMM_DEFAULT_MEMORY_H__
+#define __LABCOMM_DEFAULT_MEMORY_H__
 
 #include <stdlib.h>
 #include "labcomm.h"
 
 extern struct labcomm_memory *labcomm_default_memory;
 
+#endif
diff --git a/lib/c/2014/labcomm_default_scheduler.h b/lib/c/2014/labcomm_default_scheduler.h
index 923ea20..7ec579b 100644
--- a/lib/c/2014/labcomm_default_scheduler.h
+++ b/lib/c/2014/labcomm_default_scheduler.h
@@ -18,7 +18,11 @@
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+#ifndef __LABCOMM_DEFAULT_SCHEDULER_H__
+#define __LABCOMM_DEFAULT_SCHEDULER_H__
 
 #include "labcomm.h"
 
 extern struct labcomm_scheduler *labcomm_default_scheduler;
+
+#endif
diff --git a/lib/c/2014/labcomm_dynamic_buffer_writer.h b/lib/c/2014/labcomm_dynamic_buffer_writer.h
index 53a65d4..9fea8ed 100644
--- a/lib/c/2014/labcomm_dynamic_buffer_writer.h
+++ b/lib/c/2014/labcomm_dynamic_buffer_writer.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_DYNAMIC_BUFFER_READER_WRITER_H_
-#define _LABCOMM_DYNAMIC_BUFFER_READER_WRITER_H_
+#ifndef __LABCOMM_DYNAMIC_BUFFER_READER_WRITER_H__
+#define __LABCOMM_DYNAMIC_BUFFER_READER_WRITER_H__
 
 #include "labcomm.h"
 
diff --git a/lib/c/2014/labcomm_error.h b/lib/c/2014/labcomm_error.h
index 80e4805..5ad344b 100644
--- a/lib/c/2014/labcomm_error.h
+++ b/lib/c/2014/labcomm_error.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef __LABCOMM_ERROR_H__
-#define __LABCOMM_ERROR_H__
+#ifndef __LABCOMM_ERROR_H___
+#define __LABCOMM_ERROR_H___
 
 enum labcomm_error {
 #define LABCOMM_ERROR(name, description) name ,
diff --git a/lib/c/2014/labcomm_fd_reader.h b/lib/c/2014/labcomm_fd_reader.h
index b04aa8e..a00fe98 100644
--- a/lib/c/2014/labcomm_fd_reader.h
+++ b/lib/c/2014/labcomm_fd_reader.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_FD_READER_H_
-#define _LABCOMM_FD_READER_H_
+#ifndef __LABCOMM_FD_READER_H__
+#define __LABCOMM_FD_READER_H__
 
 #include "labcomm.h"
 
diff --git a/lib/c/2014/labcomm_fd_writer.h b/lib/c/2014/labcomm_fd_writer.h
index e89b5e7..3fbf42a 100644
--- a/lib/c/2014/labcomm_fd_writer.h
+++ b/lib/c/2014/labcomm_fd_writer.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_FD_WRITER_H_
-#define _LABCOMM_FD_WRITER_H_
+#ifndef __LABCOMM_FD_WRITER_H__
+#define __LABCOMM_FD_WRITER_H__
 
 #include "labcomm.h"
 
diff --git a/lib/c/2014/labcomm_ioctl.h b/lib/c/2014/labcomm_ioctl.h
index 9711eb7..a00a6a8 100644
--- a/lib/c/2014/labcomm_ioctl.h
+++ b/lib/c/2014/labcomm_ioctl.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef __LABCOMM_IOCTL_H__
-#define __LABCOMM_IOCTL_H__
+#ifndef __LABCOMM_IOCTL_H___
+#define __LABCOMM_IOCTL_H___
 
 #include "labcomm.h"
 
diff --git a/lib/c/2014/labcomm_private.h b/lib/c/2014/labcomm_private.h
index 1cef97d..6422a90 100644
--- a/lib/c/2014/labcomm_private.h
+++ b/lib/c/2014/labcomm_private.h
@@ -20,8 +20,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_PRIVATE_H_
-#define _LABCOMM_PRIVATE_H_
+#ifndef __LABCOMM_PRIVATE_H__
+#define __LABCOMM_PRIVATE_H__
 
 #ifdef LABCOMM_COMPAT
   #include LABCOMM_COMPAT
diff --git a/lib/c/2014/labcomm_pthread_scheduler.h b/lib/c/2014/labcomm_pthread_scheduler.h
index c8b20ec..64ace83 100644
--- a/lib/c/2014/labcomm_pthread_scheduler.h
+++ b/lib/c/2014/labcomm_pthread_scheduler.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_PTHREAD_SCHEDULER_H_
-#define _LABCOMM_PTHREAD_SCHEDULER_H_
+#ifndef __LABCOMM_PTHREAD_SCHEDULER_H__
+#define __LABCOMM_PTHREAD_SCHEDULER_H__
 
 #include "labcomm.h"
 
diff --git a/lib/c/2014/labcomm_scheduler.h b/lib/c/2014/labcomm_scheduler.h
index 07f74c2..b96b1ca 100644
--- a/lib/c/2014/labcomm_scheduler.h
+++ b/lib/c/2014/labcomm_scheduler.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_SCHEDULER_H_
-#define _LABCOMM_SCHEDULER_H_
+#ifndef __LABCOMM_SCHEDULER_H__
+#define __LABCOMM_SCHEDULER_H__
 
 #ifdef LABCOMM_COMPAT
   #include LABCOMM_COMPAT
diff --git a/lib/c/2014/labcomm_scheduler_private.h b/lib/c/2014/labcomm_scheduler_private.h
index 398552e..46b108d 100644
--- a/lib/c/2014/labcomm_scheduler_private.h
+++ b/lib/c/2014/labcomm_scheduler_private.h
@@ -19,8 +19,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef _LABCOMM_SCHEDULER_PRIVATE_H_
-#define _LABCOMM_SCHEDULER_PRIVATE_H_
+#ifndef __LABCOMM_SCHEDULER_PRIVATE_H__
+#define __LABCOMM_SCHEDULER_PRIVATE_H__
 
 #ifdef LABCOMM_COMPAT
   #include LABCOMM_COMPAT
diff --git a/lib/c/version_compare.py b/lib/c/version_compare.py
index f3e90d8..47d016b 100755
--- a/lib/c/version_compare.py
+++ b/lib/c/version_compare.py
@@ -9,7 +9,7 @@ class File:
 
     def __init__(self, path, match, replacement):
         def replace(s):
-            return re.sub('[ \t]+', ' ', s).replace(match, replacement)
+            return re.sub('[ \t]+', ' ', s).replace(match, replacement).strip()
         self.name = path.replace(match, replacement)
         self.path = path
         with open(path) as f:
@@ -50,7 +50,7 @@ if __name__ == '__main__':
         else:
             equal = True
             for l in difflib.unified_diff(a.lines, b.lines, a.path, b.path):
-                print l,
+                print l
                 equal = False
             if equal:
                 print "Identical", a.path, b.path
-- 
GitLab