Add defines.h for Csocket and make Csocket use ZNC's DEBUG()

This adds a new file defines.h and moves all the Csocket specific stuff from
main.h into this new file.

Then this makes Csocket use ZNC's DEBUG() macro for its debug output which
means this can now also be enabled by running znc --debug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1445 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-03-25 17:56:29 +00:00
parent 9a2e17c657
commit 0f52550e09
3 changed files with 32 additions and 16 deletions
+3 -1
View File
@@ -85,7 +85,7 @@
#include <set>
#include <map>
#include "main.h" // require this as a general rule, most projects have a defines.h or the like
#include "defines.h" // require this as a general rule, most projects have a defines.h or the like
#ifndef CS_STRING
# ifdef _HAS_CSTRING_
@@ -103,11 +103,13 @@
#endif /* __DEBUG__ */
#endif /* CS_DEBUG */
#ifndef PERROR
#ifdef __DEBUG__
# define PERROR( f ) __Perror( f, __FILE__, __LINE__ )
#else
# define PERROR( f ) (void)0
#endif /* __DEBUG__ */
#endif
#ifndef _NO_CSOCKET_NS // some people may not want to use a namespace
namespace Csocket
+29
View File
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2004-2009 See the AUTHORS file for details.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#ifndef _DEFINES_H
#define _DEFINES_H
// This header file is just for Csocket
#include "main.h"
#include "Utils.h"
#define CS_STRING CString
#define _NO_CSOCKET_NS
#ifdef _DEBUG
#define __DEBUG__
#endif
// Redefine some Csocket debugging mechanisms to use znc's
#define CS_DEBUG(f) DEBUG(__FILE__ << ":" << __LINE__ << " " << f)
#define PERROR(f) DEBUG(__FILE__ << ":" << __LINE__ << " " << f << ": " << strerror(GetSockError()))
#endif // !_DEFINES_H
-15
View File
@@ -53,24 +53,9 @@
#define MODULECALL(macFUNC, macUSER, macCLIENT, macEXITER)
#endif
#ifndef CS_STRING
#define CS_STRING CString
#endif
#ifndef _NO_CSOCKET_NS
#define _NO_CSOCKET_NS
#endif
#ifdef _DEBUG
#define __DEBUG__
#endif
#include <iostream>
using std::cout;
using std::cerr;
using std::endl;
#include "ZNCString.h"
#endif // !_MAIN_H