SF.net SVN: geany-plugins:[2209] trunk/geany-plugins/pretty-printer/src/ PrettyPrinter.c

colombanw at users.sourceforge.net colombanw at xxxxx
Wed Sep 21 16:57:15 UTC 2011


Revision: 2209
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=2209&view=rev
Author:   colombanw
Date:     2011-09-21 16:57:15 +0000 (Wed, 21 Sep 2011)
Log Message:
-----------
PrettyPrinter: convert PP_ERROR() to a function

Convert PP_ERROR() to a function because it cannot be implemented in
a portable way as a macro using ISO C99.

Modified Paths:
--------------
    trunk/geany-plugins/pretty-printer/src/PrettyPrinter.c

Modified: trunk/geany-plugins/pretty-printer/src/PrettyPrinter.c
===================================================================
--- trunk/geany-plugins/pretty-printer/src/PrettyPrinter.c	2011-09-21 16:56:57 UTC (rev 2208)
+++ trunk/geany-plugins/pretty-printer/src/PrettyPrinter.c	2011-09-21 16:57:15 UTC (rev 2209)
@@ -20,6 +20,9 @@
 
 //======================= FUNCTIONS ====================================================================
 
+//error reporting functions
+static void PP_ERROR(const char* fmt, ...) G_GNUC_PRINTF(1,2);  //prints an error message
+
 //xml pretty printing functions
 static void putCharInBuffer(char charToAdd);                     //put a char into the new char buffer
 static void putCharsInBuffer(const char* charsToAdd);            //put the chars into the new char buffer
@@ -73,7 +76,15 @@
 
 //============================================ GENERAL FUNCTIONS =======================================
 
-#define PP_ERROR(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__); 
+static void PP_ERROR(const char* fmt, ...)
+{
+    va_list va;
+    
+    va_start(va, fmt);
+    vfprintf(stderr, fmt, va);
+    putc('\n', stderr);
+    va_end(va);
+}
 
 int processXMLPrettyPrinting(char** buffer, int* length, PrettyPrintingOptions* ppOptions)
 {

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Plugins-Commits mailing list