]> git.draconx.ca Git - gob-dx.git/blobdiff - src/out.c
Release 0.90.4
[gob-dx.git] / src / out.c
index df0d7f57f6ccc6c03204a4ac1798cdb4feb5e42e..6b3f48fdbfaf45665021e8a3945cda2c8968b6c8 100644 (file)
--- a/src/out.c
+++ b/src/out.c
@@ -7,6 +7,8 @@
 extern FILE *out;
 extern FILE *outh;
 
+extern gboolean for_cpp;
+
 extern char *filename;
 extern char *filebase;
 
@@ -28,9 +30,10 @@ out_printf(FILE *fp,char *format,...)
 {
        va_list ap;
        char *s;
+
        va_start(ap,format);
-       
        s = g_strdup_vprintf(format,ap);
+       va_end(ap);
 
        if(fp == out)
                outline += strchrcnt(s,'\n');
@@ -41,8 +44,6 @@ out_printf(FILE *fp,char *format,...)
 
        fprintf(fp,"%s",s);
        g_free(s);
-
-       va_end(ap);
 }
 
 void
@@ -63,7 +64,10 @@ out_addline_outfile(FILE *fp)
 {
        if(fp == out) {
                outline++;
-               fprintf(fp,"#line %d \"%s.c\"\n",outline,filebase);
+               if(!for_cpp)
+                       fprintf(fp,"#line %d \"%s.c\"\n",outline,filebase);
+               else
+                       fprintf(fp,"#line %d \"%s.cc\"\n",outline,filebase);
        } else if(fp == outh) {
                outhline++;
                fprintf(fp,"#line %d \"%s.h\"\n",outhline,filebase);