Duh, revert previous patch.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@718 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
aet 2002-11-18 09:05:06 +00:00
parent 9c4844ede7
commit 4e61af2b57
2 changed files with 12 additions and 36 deletions

View File

@ -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

View File

@ -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,