From fe6287943a7a0f074f7e08d9ca64ef966d9c82e3 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 26 Sep 2009 19:37:31 +0100 Subject: [PATCH] Debug improved --- yarrg/rscommon.h | 4 ++++ yarrg/rsmain.c | 3 +++ yarrg/rsvalue.c | 8 +++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/yarrg/rscommon.h b/yarrg/rscommon.h index 871ee02..6fd394e 100644 --- a/yarrg/rscommon.h +++ b/yarrg/rscommon.h @@ -3,6 +3,10 @@ #include +#define DEBUG_FLAG_LIST \ + DF(sql) + + #include "common.h" extern struct sqlite *db; diff --git a/yarrg/rsmain.c b/yarrg/rsmain.c index a60389c..2ed1e0e 100644 --- a/yarrg/rsmain.c +++ b/yarrg/rsmain.c @@ -6,6 +6,9 @@ int o_quiet= 0; int main(int argc, const char **argv) { int ia[argc], ni=0; + + debug_flags= ~0UL; + const char *arg; while ((arg= *++argv)) { ia[ni++]= atoi(arg); diff --git a/yarrg/rsvalue.c b/yarrg/rsvalue.c index fe9c992..f399e3f 100644 --- a/yarrg/rsvalue.c +++ b/yarrg/rsvalue.c @@ -1,5 +1,9 @@ /**/ +#include "rscommon.h" + +DEBUG_DEFINE_SOME_DEBUGF(sql,sql_dprintf); + typedef struct { int commodid, src_price, src_qty, dst_price, dst_qty; } Trade; @@ -9,8 +13,6 @@ typedef struct { Trade *trades; } IslandPair; -#include "rscommon.h" - static void ipair_gettrades(int si, int di) { char *stmt= masprintf ("SELECT\n" @@ -27,7 +29,7 @@ static void ipair_gettrades(int si, int di) { " GROUP BY sell.commodid, sell.price, buy.price\n", si, di); - printf("SQL\n[\n%s\n]\n", stmt); + sql_dprintf("SQL\n[\n%s\n]\n", stmt); free(stmt); } -- 2.30.2