[gnome-builder] libide: extract macros into their own header



commit 56fbed49e8bcdb1fba97ae212304b533448f3f91
Author: Christian Hergert <christian hergert me>
Date:   Fri Apr 3 18:51:18 2015 -0700

    libide: extract macros into their own header

 libide/Makefile.am  |    1 +
 libide/ide-macros.h |   44 ++++++++++++++++++++++++++++++++++++++++++++
 libide/ide-types.h  |   16 ++--------------
 libide/ide.h        |    1 +
 4 files changed, 48 insertions(+), 14 deletions(-)
---
diff --git a/libide/Makefile.am b/libide/Makefile.am
index 5129c8e..83a0959 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -109,6 +109,7 @@ libide_1_0_la_public_sources = \
        libide/ide-language.h \
        libide/ide-log.c \
        libide/ide-log.h \
+       libide/ide-macros.h \
        libide/ide-object.c \
        libide/ide-object.h \
        libide/ide-pattern-spec.c \
diff --git a/libide/ide-macros.h b/libide/ide-macros.h
new file mode 100644
index 0000000..d586918
--- /dev/null
+++ b/libide/ide-macros.h
@@ -0,0 +1,44 @@
+/* ide-macros.h
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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 IDE_MACROS_H
+#define IDE_MACROS_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define ide_clear_weak_pointer(ptr) \
+  (*(ptr) ? (g_object_remove_weak_pointer((GObject*)*(ptr), (gpointer*)ptr),*(ptr)=NULL,1) : 0)
+
+#define ide_set_weak_pointer(ptr,obj) \
+  ((obj!=*(ptr)) ? (ide_clear_weak_pointer(ptr),*(ptr)=obj,g_object_add_weak_pointer((GObject*)obj, 
(gpointer*)ptr),1) : 0)
+
+#define ide_clear_signal_handler(obj,ptr) \
+  G_STMT_START { \
+    if (*(ptr) != 0) { \
+      g_signal_handler_disconnect((obj), *(ptr)); \
+      *(ptr) = 0; \
+    } \
+  } G_STMT_END
+
+#define ide_str_empty0(str) (((str) == NULL)||(*(str) == 0))
+
+G_END_DECLS
+
+#endif /* IDE_MACROS_H */
diff --git a/libide/ide-types.h b/libide/ide-types.h
index 118a20c..befc45b 100644
--- a/libide/ide-types.h
+++ b/libide/ide-types.h
@@ -21,21 +21,9 @@
 
 #include <glib-object.h>
 
-G_BEGIN_DECLS
-
-#define ide_clear_weak_pointer(ptr) \
-  (*(ptr) ? (g_object_remove_weak_pointer((GObject*)*(ptr), (gpointer*)ptr),*(ptr)=NULL,1) : 0)
+#include "ide-macros.h"
 
-#define ide_set_weak_pointer(ptr,obj) \
-  ((obj!=*(ptr)) ? (ide_clear_weak_pointer(ptr),*(ptr)=obj,g_object_add_weak_pointer((GObject*)obj, 
(gpointer*)ptr),1) : 0)
-
-#define ide_clear_signal_handler(obj,ptr) \
-  G_STMT_START { \
-    if (*(ptr) != 0) { \
-      g_signal_handler_disconnect((obj), *(ptr)); \
-      *(ptr) = 0; \
-    } \
-  } G_STMT_END
+G_BEGIN_DECLS
 
 typedef struct _IdeBackForwardItem             IdeBackForwardItem;
 
diff --git a/libide/ide.h b/libide/ide.h
index 7a56603..0b3559d 100644
--- a/libide/ide.h
+++ b/libide/ide.h
@@ -53,6 +53,7 @@ G_BEGIN_DECLS
 #include "ide-indenter.h"
 #include "ide-language.h"
 #include "ide-log.h"
+#include "ide-macros.h"
 #include "ide-object.h"
 #include "ide-pattern-spec.h"
 #include "ide-process.h"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]