From: Richard Russon Date: Wed, 2 Aug 2017 14:34:05 +0000 (+0100) Subject: move the debug functions to the library X-Git-Tag: neomutt-20170907~56^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9757e6397adea9f3d2f15a02f342a7cdba5fb918;p=neomutt move the debug functions to the library --- diff --git a/lib.h b/lib.h index 76ed85eb7..700bbffd5 100644 --- a/lib.h +++ b/lib.h @@ -97,9 +97,6 @@ extern FILE *debugfile; extern int debuglevel; extern char *debugfile_cmdline; extern int debuglevel_cmdline; -void mutt_debug(int level, const char *fmt, ...); -#else -#define mutt_debug(...) do { } while (0) #endif diff --git a/lib/Makefile.am b/lib/Makefile.am index 178037d3e..4d0959f2e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -3,12 +3,12 @@ include $(top_srcdir)/flymake.am AUTOMAKE_OPTIONS = 1.6 foreign -EXTRA_DIST = lib.h lib_ascii.h lib_base64.h lib_date.h lib_exit.h lib_md5.h lib_memory.h lib_message.h lib_sha1.h +EXTRA_DIST = lib.h lib_ascii.h lib_base64.h lib_date.h lib_debug.h lib_exit.h lib_md5.h lib_memory.h lib_message.h lib_sha1.h AM_CPPFLAGS = -I$(top_srcdir) noinst_LIBRARIES = liblib.a noinst_HEADERS = -liblib_a_SOURCES = lib_ascii.c lib_base64.c lib_date.c lib_exit.c lib_md5.c lib_memory.c lib_message.c lib_sha1.c +liblib_a_SOURCES = lib_ascii.c lib_base64.c lib_date.c lib_debug.c lib_exit.c lib_md5.c lib_memory.c lib_message.c lib_sha1.c diff --git a/lib/lib.h b/lib/lib.h index bd645bef3..779e90007 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -31,6 +31,7 @@ * -# @subpage ascii * -# @subpage base64 * -# @subpage date + * -# @subpage debug * -# @subpage exit * -# @subpage md5 * -# @subpage memory @@ -44,6 +45,7 @@ #include "lib_ascii.h" #include "lib_base64.h" #include "lib_date.h" +#include "lib_debug.h" #include "lib_exit.h" #include "lib_md5.h" #include "lib_memory.h" diff --git a/lib/lib_debug.c b/lib/lib_debug.c new file mode 100644 index 000000000..61fac8b47 --- /dev/null +++ b/lib/lib_debug.c @@ -0,0 +1,52 @@ +/** + * @file + * Debug messages + * + * @authors + * Copyright (C) 2017 Richard Russon + * + * @copyright + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +/** + * @page debug Debug messages + * + * Output debugging messages, suitable for a developer. + * + * | Function | Description + * | :----------- | :-------------------------------- + * | mutt_debug() | Output some debugging information + */ + +#include "config.h" +#include +#include + +/** + * mutt_debug - Output some debugging information + * @param level Debug level + * @param fmt printf-like formatting string + * @param ... Arguments to be formatted + * + * This stub function ignores the logging level and outputs all information to + * stderr. + */ +void mutt_debug(int level, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); +} diff --git a/lib/lib_debug.h b/lib/lib_debug.h new file mode 100644 index 000000000..24394c075 --- /dev/null +++ b/lib/lib_debug.h @@ -0,0 +1,34 @@ +/** + * @file + * Debug messages + * + * @authors + * Copyright (C) 2017 Richard Russon + * + * @copyright + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#ifndef _LIB_DEBUG_H +#define _LIB_DEBUG_H + +#include + +#ifdef DEBUG +void mutt_debug(int level, const char *fmt, ...); +#else +#define mutt_debug(...) do { } while (0) +#endif + +#endif /* _LIB_DEBUG_H */ diff --git a/po/POTFILES.in b/po/POTFILES.in index a13cf8a04..d3773758c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -61,6 +61,7 @@ lib.c lib/lib_ascii.c lib/lib_base64.c lib/lib_date.c +lib/lib_debug.c lib/lib_exit.c lib/lib_md5.c lib/lib_memory.c