Skip to content

Commit 07fa8f9

Browse files
committed
Removed deprecated xlog version function
1 parent 6761afe commit 07fa8f9

File tree

4 files changed

+5
-49
lines changed

4 files changed

+5
-49
lines changed

examples/xlog.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,13 @@ int logCallback(const char *pLog, size_t nLength, xlog_flag_t eFlag, void *pCtx)
1818
return 0;
1919
}
2020

21-
void greet()
22-
{
23-
printf("=========================================\n");
24-
printf("XLog Version: %s\n", XLog_Version(XFALSE));
25-
printf("=========================================\n");
26-
}
27-
2821
int main()
2922
{
3023
/* Used variables */
3124
char char_arg[32];
3225
strcpy(char_arg, "test string");
3326
int int_arg = 69;
3427

35-
/* Greet users */
36-
greet();
37-
3828
/* Initialize XLog with default parameters */
3929
XLog_Init("example", XLOG_ALL, 0);
4030
xlog_separator("[xutils]");

src/sys/log.c

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ static XATOMIC g_nHaveXLogVerShort = XFALSE;
3939
static XATOMIC g_nHaveXLogVerLong = XFALSE;
4040
static XATOMIC g_bInit = XFALSE;
4141

42-
static char g_xlogVerShort[128];
43-
static char g_xlogVerLong[256];
44-
4542
static const char *XLog_GetIndent(xlog_flag_t eFlag)
4643
{
4744
xlog_cfg_t *pCfg = &g_xlog.config;
@@ -287,7 +284,7 @@ static void XLog_DisplayStack(const xlog_ctx_t *pCtx, va_list args)
287284
XLog_DisplayMessage(pCtx, sLogInfo, nLength, sMessage);
288285
}
289286

290-
void XLog_Display(xlog_flag_t eFlag, xbool_t bNewLine, const char *pFormat, ...)
287+
void XLog_Display(xlog_flag_t eFlag, xbool_t bNewLine, const char *pFmt, ...)
291288
{
292289
XASSERT_VOID_RET(g_bInit);
293290
XSync_Lock(&g_xlog.lock);
@@ -301,14 +298,14 @@ void XLog_Display(xlog_flag_t eFlag, xbool_t bNewLine, const char *pFormat, ...)
301298
xlog_ctx_t ctx;
302299
ctx.nUsec = XTime_Get(&ctx.time);
303300
ctx.eFlag = eFlag;
304-
ctx.pFormat = pFormat;
301+
ctx.pFormat = pFmt;
305302
ctx.bNewLine = bNewLine;
306303

307304
void(*XLog_DisplayArgs)(const xlog_ctx_t *pCtx, va_list args);
308305
XLog_DisplayArgs = pCfg->bUseHeap ? XLog_DisplayHeap : XLog_DisplayStack;
309306

310307
va_list args;
311-
va_start(args, pFormat);
308+
va_start(args, pFmt);
312309
XLog_DisplayArgs(&ctx, args);
313310
va_end(args);
314311
}
@@ -392,32 +389,6 @@ void* XLog_ThrowPtr(void* pRetVal, const char *pFmt, ...)
392389
return pRetVal;
393390
}
394391

395-
const char* XLog_Version(xbool_t bShort)
396-
{
397-
if (bShort)
398-
{
399-
if (!g_nHaveXLogVerShort)
400-
{
401-
xstrncpyf(g_xlogVerShort, sizeof(g_xlogVerShort), "%d.%d.%d",
402-
XLOG_VERSION_MAJOR, XLOG_VERSION_MINOR, SLOG_BUILD_NUMBER);
403-
404-
g_nHaveXLogVerShort = XTRUE;
405-
}
406-
407-
return g_xlogVerShort;
408-
}
409-
410-
if (!g_nHaveXLogVerLong)
411-
{
412-
xstrncpyf(g_xlogVerLong, sizeof(g_xlogVerLong), "%d.%d build %d (%s)",
413-
XLOG_VERSION_MAJOR, XLOG_VERSION_MINOR, SLOG_BUILD_NUMBER, __DATE__);
414-
415-
g_nHaveXLogVerLong = XTRUE;
416-
}
417-
418-
return g_xlogVerLong;
419-
}
420-
421392
void XLog_ConfigGet(struct XLogConfig *pCfg)
422393
{
423394
XASSERT_VOID_RET(g_bInit);

src/sys/log.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ extern "C" {
1717
#include "xstd.h"
1818
#include "sync.h"
1919

20-
/* Definations for version info */
21-
#define XLOG_VERSION_MAJOR 1
22-
#define XLOG_VERSION_MINOR 8
23-
#define SLOG_BUILD_NUMBER 28
24-
2520
#define XLOG_NAME_DEFAULT "xlog"
2621

2722
/* Supported colors and tags */
@@ -226,7 +221,7 @@ uint16_t XLog_FlagsGet(void);
226221
void XLog_Init(const char* pName, uint16_t nFlags, xbool_t bTdSafe);
227222
void XLog_Destroy(void);
228223

229-
void XLog_Display(xlog_flag_t eFlag, xbool_t bNewLine, const char *pFormat, ...);
224+
void XLog_Display(xlog_flag_t eFlag, xbool_t bNewLine, const char *pFmt, ...);
230225
XSTATUS XLog_Throw(int nRetVal, const char *pFmt, ...);
231226
XSTATUS XLog_Throwe(int nRetVal, const char *pFmt, ...);
232227
void* XLog_ThrowPtr(void* pRetVal, const char *pFmt, ...);

src/xver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#define XUTILS_VERSION_MAX 2
1414
#define XUTILS_VERSION_MIN 6
15-
#define XUTILS_BUILD_NUMBER 35
15+
#define XUTILS_BUILD_NUMBER 36
1616

1717
#ifdef __cplusplus
1818
extern "C" {

0 commit comments

Comments
 (0)