Mercurial > geeqie
diff src/debug.c @ 507:135570a8bd96
Move debug macros from main.h to new debug.h.
Make debug_level static to debug.c and add utility functions
to manipulate it.
Add #include "debug.h" where needed.
author | zas_ |
---|---|
date | Thu, 24 Apr 2008 08:53:39 +0000 |
parents | |
children | b78a91d0779e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/debug.c Thu Apr 24 08:53:39 2008 +0000 @@ -0,0 +1,40 @@ +/* + * Geeqie + * Copyright (C) 2008 The Geeqie Team + * + * Authors: Vladimir Nadvornik, Laurent Monin + * + * This software is released under the GNU General Public License (GNU GPL). + * Please read the included file COPYING for more information. + * This software comes with no warranty of any kind, use at your own risk! + */ + +#include "main.h" +#include "debug.h" + +#ifdef DEBUG + +static gint debug_level = DEBUG_LEVEL_MIN; + + +gint get_debug_level(void) +{ + return debug_level; +} + +void set_debug_level(gint new_level) +{ + debug_level = CLAMP(new_level, DEBUG_LEVEL_MIN, DEBUG_LEVEL_MAX); +} + +void debug_level_add(gint delta) +{ + set_debug_level(debug_level + delta); +} + +gint required_debug_level(gint level) +{ + return (debug_level >= level); +} + +#endif