Skip to content

Commit

Permalink
Move debug related code to debug.c/h
Browse files Browse the repository at this point in the history
  • Loading branch information
techee committed Oct 8, 2016
1 parent 7ebcfb7 commit ded5ea3
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 18 deletions.
1 change: 1 addition & 0 deletions ctags/Makefile.am
Expand Up @@ -57,6 +57,7 @@ libctags_la_SOURCES = \
main/args.h \
main/ctags.h \
main/debug.h \
main/debug.c \
main/entry.c \
main/entry.h \
main/error.c \
Expand Down
23 changes: 23 additions & 0 deletions ctags/main/debug.c
@@ -0,0 +1,23 @@
/*
* Copyright (c) 1996-2002, Darren Hiebert
*
* This source code is released for free distribution under the terms of the
* GNU General Public License version 2 or (at your option) any later version.
*
* This module contains debugging functions.
*/

/*
* INCLUDE FILES
*/
#include "general.h" /* must always come first */

#include <glib.h>

#include "debug.h"

/* wrap g_warning so we don't include glib.h for all parsers, to keep compat with CTags */
void utils_warn(const char *msg)
{
g_warning("%s", msg);
}
15 changes: 12 additions & 3 deletions ctags/main/debug.h
Expand Up @@ -14,9 +14,18 @@
*/
#include "general.h" /* must always come first */

#ifdef DEBUG
# include <assert.h>
#endif
#include "entry.h"

/*
* Macros
*/

/* fake debug statement macro */
#define DebugStatement(x) ;
#define PrintStatus(x) ;
/* wrap g_warning so we don't include glib.h for all parsers, to keep compat with CTags */
extern void utils_warn(const char *msg);
#define Assert(x) if (!(x)) utils_warn("Assert(" #x ") failed!")
#define AssertNotReached() Assert(!"The control reaches unexpected place")

#endif /* CTAGS_MAIN_DEBUG_H */
1 change: 1 addition & 0 deletions ctags/main/entry.c
Expand Up @@ -35,6 +35,7 @@
#endif

#include "ctags.h"
#include "debug.h"
#include "entry.h"
#include "main.h"
#include "options.h"
Expand Down
6 changes: 0 additions & 6 deletions ctags/main/general.h
Expand Up @@ -96,12 +96,6 @@ int fnmatch(const char *pattern, const char *string, int flags);
#endif


/* fake debug statement macro */
#define DebugStatement(x) ;
#define PrintStatus(x) ;
/* wrap g_warning so we don't include glib.h for all parsers, to keep compat with CTags */
void utils_warn(const char *msg);
#define Assert(x) if (!(x)) utils_warn("Assert(" #x ") failed!")
/*
* DATA DECLARATIONS
*/
Expand Down
1 change: 1 addition & 0 deletions ctags/main/lregex.c
Expand Up @@ -27,6 +27,7 @@
# endif
#endif

#include "debug.h"
#include "mio.h"
#include "entry.h"
#include "parse.h"
Expand Down
8 changes: 0 additions & 8 deletions ctags/main/main.c
Expand Up @@ -22,8 +22,6 @@
*/
#include "general.h" /* must always come first */

#include <glib.h>

/* To provide timings features if available.
*/
#ifdef HAVE_CLOCK
Expand Down Expand Up @@ -168,9 +166,3 @@ static void printTotals (const clock_t *const timeStamps)
}

#endif /* Unused in Geany */

/* wrap g_warning so we don't include glib.h for all parsers, to keep compat with CTags */
void utils_warn(const char *msg)
{
g_warning("%s", msg);
}
2 changes: 1 addition & 1 deletion ctags/main/parse.c
Expand Up @@ -15,7 +15,7 @@

#include <string.h>


#include "debug.h"
#include "mio.h"
#include "entry.h"
#include "keyword.h"
Expand Down
1 change: 1 addition & 0 deletions ctags/main/sort.c
Expand Up @@ -18,6 +18,7 @@
#include <string.h>
#include <stdio.h>

#include "debug.h"
#include "entry.h"
#include "routines.h"
#include "options.h"
Expand Down
1 change: 1 addition & 0 deletions ctags/parsers/powershell.c
Expand Up @@ -14,6 +14,7 @@
* INCLUDE FILES
*/
#include "general.h" /* must always come first */
#include "debug.h"
#include "main.h"
#include "parse.h"
#include "read.h"
Expand Down

0 comments on commit ded5ea3

Please sign in to comment.