Performance: optimise call to grib_context_log (stack)
@@ -909,16 +909,19 @@ void grib_context_set_data_accessing_proc(grib_context* c, grib_data_read_proc r
c->tell = tell;
}
-/* logging procedure */
+/* Logging procedure */
void grib_context_log(const grib_context *c,int level, const char* fmt, ...)
{
- char msg[1024];
- va_list list;
-
/* Save some CPU */
if( (level == GRIB_LOG_DEBUG && c->debug<1) ||
(level == GRIB_LOG_WARNING && c->debug<2) )
+ {
return;
+ }
+ else
+ {
+ char msg[1024];
+ va_list list;
va_start(list,fmt);
vsprintf(msg, fmt, list);
@@ -943,12 +946,12 @@ void grib_context_log(const grib_context *c,int level, const char* fmt, ...)
#endif
}
-
if(c->output_log)
c->output_log(c,level,msg);
}
+}
-/* logging procedure */
+/* Logging procedure */
void grib_context_print(const grib_context *c, void* descriptor,const char* fmt, ...)
{
char msg[1024];
