From: Florian Forster Date: Wed, 25 Nov 2009 19:07:21 +0000 (+0100) Subject: src/{Makefile.am,main.c}: Use the debugging as determined by the configure script. X-Git-Tag: librouteros-0.1.0~5 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4c2dc5ebae2700b37ba949c0d98ad2f148fc723d;p=routeros-api.git src/{Makefile.am,main.c}: Use the debugging as determined by the configure script. --- diff --git a/src/Makefile.am b/src/Makefile.am index db3f30b..da3dda1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,6 +2,9 @@ AUTOMAKE_OPTIONS = foreign no-dependencies if COMPILER_IS_GCC AM_CFLAGS = -Wall -Werror +if BUILD_WITH_DEBUG +AM_CFLAGS += -Wextra -g -O0 +endif endif include_HEADERS = routeros_api.h routeros_version.h diff --git a/src/main.c b/src/main.c index a941750..5981dbf 100644 --- a/src/main.c +++ b/src/main.c @@ -27,6 +27,8 @@ # define _POSIX_C_SOURCE 200112L #endif +#include + #include #include #include @@ -44,7 +46,7 @@ #include "routeros_api.h" -#if 1 +#if WITH_DEBUG # define ros_debug(...) fprintf (stdout, __VA_ARGS__) #else # define ros_debug(...) /**/ @@ -165,6 +167,7 @@ static int reply_add_keyval (ros_reply_t *r, const char *key, /* {{{ */ return (0); } /* }}} int reply_add_keyval */ +#if WITH_DEBUG static void reply_dump (const ros_reply_t *r) /* {{{ */ { if (r == NULL) @@ -188,6 +191,9 @@ static void reply_dump (const ros_reply_t *r) /* {{{ */ reply_dump (r->next); } /* }}} void reply_dump */ +#else +# define reply_dump(foo) /**/ +#endif static void reply_free (ros_reply_t *r) /* {{{ */ { @@ -635,7 +641,6 @@ static int login2_handler (ros_connection_t *c, const ros_reply_t *r, /* {{{ */ if (r == NULL) return (EINVAL); - printf ("login2_handler has been called.\n"); reply_dump (r); if (strcmp (r->status, "trap") == 0) @@ -727,8 +732,6 @@ static int login_handler (ros_connection_t *c, const ros_reply_t *r, /* {{{ */ * =ret=ebddd18303a54111e2dea05a92ab46b4 * -- >8 -- */ - - printf ("login_handler has been called.\n"); reply_dump (r); if (strcmp (r->status, "done") != 0)