[ORBit2] Fix some problems with the preprocessor on Solaris. Patch from Thomas Clausner. Closes bug #563046.



commit 1b269c714de036f6aa60ecfc27ac38a0d13ef724
Author: Kjartan Maraas <kmaraas gnome org>
Date:   Wed Oct 28 10:37:23 2009 +0100

    Fix some problems with the preprocessor on Solaris. Patch from Thomas Clausner. Closes bug #563046.

 src/idl-compiler/orbit-idl-c-headers.c |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/src/idl-compiler/orbit-idl-c-headers.c b/src/idl-compiler/orbit-idl-c-headers.c
index f9c3b6b..5d65803 100644
--- a/src/idl-compiler/orbit-idl-c-headers.c
+++ b/src/idl-compiler/orbit-idl-c-headers.c
@@ -574,21 +574,29 @@ static void
 ch_output_codefrag(IDL_tree tree, OIDL_Run_Info *rinfo, OIDL_C_Info *ci)
 {
   GSList *list;
+  char *ctmp;
 
   for(list = IDL_CODEFRAG(tree).lines; list;
       list = g_slist_next(list)) {
-    if(!strncmp(list->data,
-		"#pragma include_defs",
-		sizeof("#pragma include_defs")-1)) {
-	char *ctmp, *cte;
-	ctmp = ((char *)list->data) + sizeof("#pragma include_defs");
-	while(*ctmp && (isspace((int)*ctmp) || *ctmp == '"')) ctmp++;
-	cte = ctmp;
-	while(*cte && !isspace((int)*cte) && *cte != '"') cte++;
-	*cte = '\0';
-      fprintf(ci->fh, "#include <%s>\n", ctmp);
-    } else
-      fprintf(ci->fh, "%s\n", (char *)list->data);
+    ctmp = list->data;
+    if(!strncmp(ctmp, "#pragma", sizeof("#pragma")-1)) {
+      ctmp += sizeof("#pragma")-1;
+      if (*ctmp && (isspace((int)*ctmp))) {
+	while(*ctmp && (isspace((int)*ctmp))) ctmp++;
+	if(!strncmp(ctmp, "include_defs", sizeof("include_defs")-1)) {
+	  char *cte;
+
+	  ctmp += sizeof("include_defs")-1;
+	  while(*ctmp && (isspace((int)*ctmp) || *ctmp == '"')) ctmp++;
+	  cte = ctmp;
+	  while(*cte && !isspace((int)*cte) && *cte != '"') cte++;
+	  *cte = '\0';
+	  fprintf(ci->fh, "#include <%s>\n", ctmp);
+	  continue;
+	}
+      }
+    }
+    fprintf(ci->fh, "%s\n", (char *)list->data);
   }
 }
 



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