From 4e61af2b57cbfdc3bd62d7f3c84fb618f49edbd1 Mon Sep 17 00:00:00 2001 From: aet Date: Mon, 18 Nov 2002 09:05:06 +0000 Subject: [PATCH] Duh, revert previous patch. git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@718 c6295689-39f2-0310-b995-f0e70906c6a9 --- src/libopensc/log.c | 10 +++++----- src/libopensc/log.h | 38 +++++++------------------------------- 2 files changed, 12 insertions(+), 36 deletions(-) diff --git a/src/libopensc/log.c b/src/libopensc/log.c index a24e2396..4732ca0c 100644 --- a/src/libopensc/log.c +++ b/src/libopensc/log.c @@ -38,21 +38,21 @@ #endif #ifndef __GNUC__ -void error(struct sc_context *ctx, const char* file, int line, const char *func, const char *format, ...) +void error(struct sc_context *ctx, const char *format, ...) { va_list ap; va_start(ap, format); - do_log2(ctx, SC_LOG_TYPE_ERROR, file, line, func, format, ap); + do_log2(ctx, SC_LOG_TYPE_ERROR, NULL, 0, "", format, ap); va_end(ap); } -void debug(struct sc_context *ctx, const char* file, int line, const char *func, const char *format, ...) +void debug(struct sc_context *ctx, const char *format, ...) { va_list ap; va_start(ap, format); - do_log2(ctx, SC_LOG_TYPE_DEBUG, file, line, func, format, ap); + do_log2(ctx, SC_LOG_TYPE_DEBUG, NULL, 0, "", format, ap); va_end(ap); } @@ -129,7 +129,7 @@ void do_log2(struct sc_context *ctx, int type, const char *file, } } if (file != NULL) { - r = snprintf(buf, sizeof(buf), "%s:%d:%s: ", file, line, func ? func : ""); + r = snprintf(buf, sizeof(buf), "%s:%d:%s: ", file, line, func); if (r < 0) return; } else diff --git a/src/libopensc/log.h b/src/libopensc/log.h index 52c96384..df084367 100644 --- a/src/libopensc/log.h +++ b/src/libopensc/log.h @@ -32,16 +32,18 @@ extern "C" { #define SC_LOG_TYPE_VERBOSE 1 #define SC_LOG_TYPE_DEBUG 2 -/* You can't do #ifndef __FUNCTION__ */ -#if !defined(__GNUC__) && !defined(__IBMC__) -#define __FUNCTION__ NULL -#endif - #if defined(__GNUC__) #define error(ctx, format, args...) do_log(ctx, SC_LOG_TYPE_ERROR, __FILE__, __LINE__, __FUNCTION__, format , ## args) #define debug(ctx, format, args...) do_log(ctx, SC_LOG_TYPE_DEBUG, __FILE__, __LINE__, __FUNCTION__, format , ## args) +#else + +void error(struct sc_context *ctx, const char *format, ...); +void debug(struct sc_context *ctx, const char *format, ...); + +#endif + #define SC_FUNC_CALLED(ctx, level) {\ if ((ctx)->debug >= level)\ debug(ctx, "called\n"); } @@ -61,32 +63,6 @@ extern "C" { }\ } -#else - -void error(struct sc_context *ctx, const char* file, int line, const char *func, const char *format, ...); -void debug(struct sc_context *ctx, const char* file, int line, const char *func, const char *format, ...); - -#define SC_FUNC_CALLED(ctx, level) {\ - if ((ctx)->debug >= level)\ - debug(ctx, __FILE__, __LINE__, __FUNCTION__, "called\n"); } -#define SC_FUNC_RETURN(ctx, level, r) {\ - int _ret = r;\ - if (_ret < 0) {\ - error(ctx, __FILE__, __LINE__, __FUNCTION__, "returning with: %s\n", sc_strerror(_ret));\ - } else if ((ctx)->debug >= level) {\ - debug(ctx, __FILE__, __LINE__, __FUNCTION__, "returning with: %d\n", _ret);\ - }\ - return _ret; } -#define SC_TEST_RET(ctx, r, text) {\ - int _ret = (r);\ - if (_ret < 0) {\ - error((ctx), __FILE__, __LINE__, __FUNCTION__, "%s: %s\n", (text), sc_strerror(_ret));\ - return _ret;\ - }\ -} - -#endif - void do_log(struct sc_context *ctx, int facility, const char *file, int line, const char *func, const char *format, ...); void do_log2(struct sc_context *ctx, int type, const char *file,