[Pcsclite-cvs-commit] r4821 - in /trunk/PCSC/src: PCSC/debuglog.h debug.c debuglog.c hotplug_libhal.c winscard_svc.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Tue Mar 16 09:43:31 UTC 2010
Author: rousseau
Date: Tue Mar 16 09:43:31 2010
New Revision: 4821
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4821
Log:
If NO_LOG is defined then no log are displayed. The idea is to limit the
binaries size on disk and RAM consumption at execution time.
With NO_LOG defined we gain 26% (17 kB) for the .text segment of pcscd
and 15% (4 kB) for the .text segment of libpcsclite.so (for i386)
Modified:
trunk/PCSC/src/PCSC/debuglog.h
trunk/PCSC/src/debug.c
trunk/PCSC/src/debuglog.c
trunk/PCSC/src/hotplug_libhal.c
trunk/PCSC/src/winscard_svc.c
Modified: trunk/PCSC/src/PCSC/debuglog.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/PCSC/debuglog.h?rev=4821&op=diff
==============================================================================
--- trunk/PCSC/src/PCSC/debuglog.h (original)
+++ trunk/PCSC/src/PCSC/debuglog.h Tue Mar 16 09:43:31 2010
@@ -67,6 +67,22 @@
#define __FUNCTION__ ""
#endif
+#ifdef NO_LOG
+
+#define Log0(priority) do { } while(0)
+#define Log1(priority, fmt) do { } while(0)
+#define Log2(priority, fmt, data) do { } while(0)
+#define Log3(priority, fmt, data1, data2) do { } while(0)
+#define Log4(priority, fmt, data1, data2, data3) do { } while(0)
+#define Log9(priority, fmt, data1, data2, data3, data4, data5, data6, data7, data8) do { } while(0)
+#define LogXxd(priority, msg, buffer, size) do { } while(0)
+
+#define DebugLogA(a)
+#define DebugLogB(a, b)
+#define DebugLogC(a, b,c)
+
+#else
+
#define Log0(priority) log_msg(priority, "%s:%d:%s()", __FILE__, __LINE__, __FUNCTION__)
#define Log1(priority, fmt) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__)
#define Log2(priority, fmt, data) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data)
@@ -78,6 +94,8 @@
#define DebugLogA(a) Log1(PCSC_LOG_INFO, a)
#define DebugLogB(a, b) Log2(PCSC_LOG_INFO, a, b)
#define DebugLogC(a, b,c) Log3(PCSC_LOG_INFO, a, b, c)
+
+#endif /* NO_LOG */
PCSC_API void log_msg(const int priority, const char *fmt, ...);
PCSC_API void log_xxd(const int priority, const char *msg,
Modified: trunk/PCSC/src/debug.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/debug.c?rev=4821&op=diff
==============================================================================
--- trunk/PCSC/src/debug.c (original)
+++ trunk/PCSC/src/debug.c Tue Mar 16 09:43:31 2010
@@ -25,6 +25,25 @@
#include "strlcpycat.h"
#define DEBUG_BUF_SIZE 2048
+
+#ifdef NO_LOG
+
+void log_msg(const int priority, const char *fmt, ...)
+{
+ (void)priority;
+ (void)fmt;
+}
+
+void log_xxd(const int priority, const char *msg, const unsigned char *buffer,
+ const int len)
+{
+ (void)priority;
+ (void)msg;
+ (void)buffer;
+ (void)len;
+}
+
+#else
/** default level is quiet to avoid polluting fd 2 (possibly NOT stderr) */
static char LogLevel = PCSC_LOG_CRITICAL+1;
@@ -143,3 +162,5 @@
fprintf(stderr, "%s\n", DebugBuffer);
} /* log_xxd */
+#endif
+
Modified: trunk/PCSC/src/debuglog.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/debuglog.c?rev=4821&op=diff
==============================================================================
--- trunk/PCSC/src/debuglog.c (original)
+++ trunk/PCSC/src/debuglog.c Tue Mar 16 09:43:31 2010
@@ -34,6 +34,55 @@
#include "sys_generic.h"
#include "strlcpycat.h"
+#ifdef NO_LOG
+
+void log_msg(const int priority, const char *fmt, ...)
+{
+ (void)priority;
+ (void)fmt;
+}
+
+void log_xxd(const int priority, const char *msg, const unsigned char *buffer,
+ const int len)
+{
+ (void)priority;
+ (void)msg;
+ (void)buffer;
+ (void)len;
+}
+
+void DebugLogSuppress(const int lSType)
+{
+ (void)lSType;
+}
+
+void DebugLogSetLogType(const int dbgtype)
+{
+ (void)dbgtype;
+}
+
+void DebugLogSetLevel(const int level)
+{
+ (void)level;
+}
+
+INTERNAL int DebugLogSetCategory(const int dbginfo)
+{
+ (void)dbginfo;
+
+ return 0;
+}
+
+INTERNAL void DebugLogCategory(const int category, const unsigned char *buffer,
+ const int len)
+{
+ (void)category;
+ (void)buffer;
+ (void)len;
+}
+
+#else
+
/**
* Max string size when dumping a 256 bytes longs APDU
* Should be bigger than 256*3+30
@@ -303,3 +352,5 @@
} /* debug_xxd */
#endif
+#endif /* NO_LOG */
+
Modified: trunk/PCSC/src/hotplug_libhal.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/hotplug_libhal.c?rev=4821&op=diff
==============================================================================
--- trunk/PCSC/src/hotplug_libhal.c (original)
+++ trunk/PCSC/src/hotplug_libhal.c Tue Mar 16 09:43:31 2010
@@ -86,10 +86,12 @@
*
* @param udi Universal Device Id
*/
+#ifndef NO_LOG
static const char *short_name(const char *udi)
{
return &udi[sizeof(UDI_BASE) - 1];
} /* short_name */
+#endif
static LONG HPReadBundleValues(void)
Modified: trunk/PCSC/src/winscard_svc.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_svc.c?rev=4821&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_svc.c (original)
+++ trunk/PCSC/src/winscard_svc.c Tue Mar 16 09:43:31 2010
@@ -243,6 +243,7 @@
* @param[in] dwIndex Index of an avaiable Application Context slot in
* \c SCONTEXT *.
*/
+#ifndef NO_LOG
static const char *CommandsText[] = {
"NULL",
"ESTABLISH_CONTEXT", /* 0x01 */
@@ -267,6 +268,7 @@
"CMD_STOP_WAITING_READER_STATE_CHANGE", /* 0x14 */
"NULL"
};
+#endif
#define READ_BODY(v) \
if (header.size != sizeof(v)) { goto wrong_length; } \
More information about the Pcsclite-cvs-commit
mailing list