From 01c69a637754d9724cc29719b77b79195ec66916 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sat, 12 Sep 2020 15:02:21 +0000 Subject: [PATCH] TD-1225 rename files --- src/plugins/http/inc/ehttp_util_string.h | 13 --- .../http/inc/{gcHandle.h => httpGcHandle.h} | 0 .../http/inc/{gcJson.h => httpGcJson.h} | 0 .../http/inc/{ehttp_gzip.h => httpGzip.h} | 0 src/plugins/http/inc/httpInt.h | 3 +- .../http/inc/{ehttp_parser.h => httpParser.h} | 15 ++- .../inc/{restHandle.h => httpRestHandle.h} | 0 .../http/inc/{restJson.h => httpRestJson.h} | 0 .../http/inc/{tgHandle.h => httpTgHandle.h} | 0 .../http/inc/{tgJson.h => httpTgJson.h} | 0 src/plugins/http/src/ehttp_util_string.c | 27 ------ src/plugins/http/src/httpContext.c | 5 +- .../http/src/{gcHandle.c => httpGcHandle.c} | 6 +- .../http/src/{gcJson.c => httpGcJson.c} | 4 +- .../http/src/{ehttp_gzip.c => httpGzip.c} | 5 +- .../http/src/{ehttp_parser.c => httpParser.c} | 40 +++++--- .../src/{restHandle.c => httpRestHandle.c} | 4 +- .../http/src/{restJson.c => httpRestJson.c} | 4 +- src/plugins/http/src/httpServer.c | 4 +- src/plugins/http/src/httpSystem.c | 6 +- .../http/src/{tgHandle.c => httpTgHandle.c} | 4 +- .../http/src/{tgJson.c => httpTgJson.c} | 4 +- src/util/inc/elog.h | 71 -------------- src/util/src/elog.c | 95 ------------------- 24 files changed, 60 insertions(+), 250 deletions(-) delete mode 100644 src/plugins/http/inc/ehttp_util_string.h rename src/plugins/http/inc/{gcHandle.h => httpGcHandle.h} (100%) rename src/plugins/http/inc/{gcJson.h => httpGcJson.h} (100%) rename src/plugins/http/inc/{ehttp_gzip.h => httpGzip.h} (100%) rename src/plugins/http/inc/{ehttp_parser.h => httpParser.h} (89%) rename src/plugins/http/inc/{restHandle.h => httpRestHandle.h} (100%) rename src/plugins/http/inc/{restJson.h => httpRestJson.h} (100%) rename src/plugins/http/inc/{tgHandle.h => httpTgHandle.h} (100%) rename src/plugins/http/inc/{tgJson.h => httpTgJson.h} (100%) delete mode 100644 src/plugins/http/src/ehttp_util_string.c rename src/plugins/http/src/{gcHandle.c => httpGcHandle.c} (99%) rename src/plugins/http/src/{gcJson.c => httpGcJson.c} (99%) rename src/plugins/http/src/{ehttp_gzip.c => httpGzip.c} (99%) rename src/plugins/http/src/{ehttp_parser.c => httpParser.c} (98%) rename src/plugins/http/src/{restHandle.c => httpRestHandle.c} (98%) rename src/plugins/http/src/{restJson.c => httpRestJson.c} (99%) rename src/plugins/http/src/{tgHandle.c => httpTgHandle.c} (99%) rename src/plugins/http/src/{tgJson.c => httpTgJson.c} (99%) delete mode 100644 src/util/inc/elog.h delete mode 100644 src/util/src/elog.c diff --git a/src/plugins/http/inc/ehttp_util_string.h b/src/plugins/http/inc/ehttp_util_string.h deleted file mode 100644 index eb44805f96..0000000000 --- a/src/plugins/http/inc/ehttp_util_string.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef HTTP_UTIL_STRING -#define HTTP_UTIL_STRING - -typedef struct HttpUtilString { - char * str; - size_t len; -} HttpUtilString; - -void httpParserCleanupString(HttpUtilString *str); -int32_t httpParserAppendString(HttpUtilString *str, const char *s, int32_t len); -void httpParserClearString(HttpUtilString *str); - -#endif diff --git a/src/plugins/http/inc/gcHandle.h b/src/plugins/http/inc/httpGcHandle.h similarity index 100% rename from src/plugins/http/inc/gcHandle.h rename to src/plugins/http/inc/httpGcHandle.h diff --git a/src/plugins/http/inc/gcJson.h b/src/plugins/http/inc/httpGcJson.h similarity index 100% rename from src/plugins/http/inc/gcJson.h rename to src/plugins/http/inc/httpGcJson.h diff --git a/src/plugins/http/inc/ehttp_gzip.h b/src/plugins/http/inc/httpGzip.h similarity index 100% rename from src/plugins/http/inc/ehttp_gzip.h rename to src/plugins/http/inc/httpGzip.h diff --git a/src/plugins/http/inc/httpInt.h b/src/plugins/http/inc/httpInt.h index 89972adc87..4348e5e090 100644 --- a/src/plugins/http/inc/httpInt.h +++ b/src/plugins/http/inc/httpInt.h @@ -27,8 +27,7 @@ #include "httpCode.h" #include "httpLog.h" #include "httpJson.h" - -#include "ehttp_parser.h" +#include "httpParser.h" #define HTTP_MAX_CMD_SIZE 1024 #define HTTP_MAX_BUFFER_SIZE 1024*1024 diff --git a/src/plugins/http/inc/ehttp_parser.h b/src/plugins/http/inc/httpParser.h similarity index 89% rename from src/plugins/http/inc/ehttp_parser.h rename to src/plugins/http/inc/httpParser.h index 7ddfcb32db..4facea0286 100644 --- a/src/plugins/http/inc/ehttp_parser.h +++ b/src/plugins/http/inc/httpParser.h @@ -1,8 +1,7 @@ #ifndef HTTP_PARSER_H #define HTTP_PARSER_H -#include "ehttp_util_string.h" -#include "ehttp_gzip.h" +#include "httpGzip.h" struct HttpContext; @@ -25,6 +24,11 @@ typedef enum HTTP_PARSER_STATE { HTTP_PARSER_ERROR, } HTTP_PARSER_STATE; +typedef struct HttpParserString { + char * str; + size_t len; +} HttpParserString; + typedef struct HttpParserStatusObj { int32_t status_code; const char *status_desc; @@ -77,11 +81,16 @@ typedef struct HttpParserObj { size_t received_chunk_size; size_t received_size; ehttp_gzip_t * gzip; - HttpUtilString str; + HttpParserString str; HTTP_PARSER_STATE *stacks; size_t stacks_count; } HttpParserObj; +void httpParserCleanupString(HttpParserString *str); +int32_t httpParserAppendString(HttpParserString *str, const char *s, int32_t len); +void httpParserClearString(HttpParserString *str); + + HttpParserObj* httpParserCreate(HttpParserCallbackObj callbacks, HttpParserConfObj conf, void *arg); void httpParserDestroy(HttpParserObj *parser); int32_t httpParserBuf(struct HttpContext *pContext, HttpParserObj *parser, const char *buf, int32_t len); diff --git a/src/plugins/http/inc/restHandle.h b/src/plugins/http/inc/httpRestHandle.h similarity index 100% rename from src/plugins/http/inc/restHandle.h rename to src/plugins/http/inc/httpRestHandle.h diff --git a/src/plugins/http/inc/restJson.h b/src/plugins/http/inc/httpRestJson.h similarity index 100% rename from src/plugins/http/inc/restJson.h rename to src/plugins/http/inc/httpRestJson.h diff --git a/src/plugins/http/inc/tgHandle.h b/src/plugins/http/inc/httpTgHandle.h similarity index 100% rename from src/plugins/http/inc/tgHandle.h rename to src/plugins/http/inc/httpTgHandle.h diff --git a/src/plugins/http/inc/tgJson.h b/src/plugins/http/inc/httpTgJson.h similarity index 100% rename from src/plugins/http/inc/tgJson.h rename to src/plugins/http/inc/httpTgJson.h diff --git a/src/plugins/http/src/ehttp_util_string.c b/src/plugins/http/src/ehttp_util_string.c deleted file mode 100644 index 8900aa89bb..0000000000 --- a/src/plugins/http/src/ehttp_util_string.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "os.h" -#include "ehttp_util_string.h" - -void httpParserCleanupString(HttpUtilString *str) { - free(str->str); - str->str = NULL; - str->len = 0; -} - -int32_t httpParserAppendString(HttpUtilString *str, const char *s, int32_t len) { - int32_t n = str->len; - char *p = (char*)realloc(str->str, n + len + 1); - if (!p) return -1; - strncpy(p+n, s, len); - p[n+len] = '\0'; - str->str = p; - str->len = n+len; - return 0; -} - -void httpParserClearString(HttpUtilString *str) { - if (str->str) { - str->str[0] = '\0'; - str->len = 0; - } -} - diff --git a/src/plugins/http/src/httpContext.c b/src/plugins/http/src/httpContext.c index 987de519c7..d310f27ee6 100644 --- a/src/plugins/http/src/httpContext.c +++ b/src/plugins/http/src/httpContext.c @@ -27,7 +27,6 @@ #include "httpSql.h" #include "httpSession.h" #include "httpContext.h" -#include "elog.h" extern bool httpGetHttpMethod(HttpContext* pContext); extern bool httpParseURL(HttpContext* pContext); @@ -144,8 +143,8 @@ HttpContext *httpCreateContext(int32_t fd) { HttpContext *httpGetContext(void *ptr) { uint64_t handleVal = (uint64_t)ptr; HttpContext **ppContext = taosCacheAcquireByKey(tsHttpServer.contextCache, &handleVal, sizeof(HttpContext *)); - EQ_ASSERT(ppContext); - EQ_ASSERT(*ppContext); + ASSERT(ppContext); + ASSERT(*ppContext); if (ppContext) { HttpContext *pContext = *ppContext; diff --git a/src/plugins/http/src/gcHandle.c b/src/plugins/http/src/httpGcHandle.c similarity index 99% rename from src/plugins/http/src/gcHandle.c rename to src/plugins/http/src/httpGcHandle.c index 4aed6eb5cc..09f17cae66 100644 --- a/src/plugins/http/src/gcHandle.c +++ b/src/plugins/http/src/httpGcHandle.c @@ -15,11 +15,11 @@ #define _DEFAULT_SOURCE #include "os.h" +#include "taosdef.h" #include "cJSON.h" #include "httpLog.h" -#include "gcHandle.h" -#include "gcJson.h" -#include "taosdef.h" +#include "httpGcHandle.h" +#include "httpGcJson.h" static HttpDecodeMethod gcDecodeMethod = {"grafana", gcProcessRequest}; static HttpEncodeMethod gcHeartBeatMethod = { diff --git a/src/plugins/http/src/gcJson.c b/src/plugins/http/src/httpGcJson.c similarity index 99% rename from src/plugins/http/src/gcJson.c rename to src/plugins/http/src/httpGcJson.c index 94d53db6ef..85cae24201 100644 --- a/src/plugins/http/src/gcJson.c +++ b/src/plugins/http/src/httpGcJson.c @@ -15,8 +15,8 @@ #define _DEFAULT_SOURCE #include "os.h" -#include "gcHandle.h" -#include "gcJson.h" +#include "httpGcHandle.h" +#include "httpGcJson.h" #include "httpJson.h" #include "httpResp.h" diff --git a/src/plugins/http/src/ehttp_gzip.c b/src/plugins/http/src/httpGzip.c similarity index 99% rename from src/plugins/http/src/ehttp_gzip.c rename to src/plugins/http/src/httpGzip.c index ded344dfea..5712aff7ec 100644 --- a/src/plugins/http/src/ehttp_gzip.c +++ b/src/plugins/http/src/httpGzip.c @@ -1,9 +1,6 @@ -#include "ehttp_gzip.h" - #include "os.h" #include "zlib.h" - -#include +#include "httpGzip.h" typedef enum { EHTTP_GZIP_INITING, diff --git a/src/plugins/http/src/ehttp_parser.c b/src/plugins/http/src/httpParser.c similarity index 98% rename from src/plugins/http/src/ehttp_parser.c rename to src/plugins/http/src/httpParser.c index 0d0382078f..c1fd481efd 100644 --- a/src/plugins/http/src/ehttp_parser.c +++ b/src/plugins/http/src/httpParser.c @@ -1,18 +1,8 @@ #include "os.h" #include "httpLog.h" #include "httpContext.h" -#include "ehttp_util_string.h" -#include "ehttp_parser.h" - -#include "ehttp_gzip.h" -#include "ehttp_util_string.h" -#include "elog.h" - - -#include -#include -#include - +#include "httpParser.h" +#include "httpGzip.h" static HttpParserStatusObj status_codes[] = { {100, "Continue"}, @@ -213,7 +203,7 @@ void httpParserDestroy(HttpParserObj *parser) { char *ehttp_parser_urldecode(const char *enc) { int ok = 1; - HttpUtilString str = {0}; + HttpParserString str = {0}; while (*enc) { char *p = strchr(enc, '%'); if (!p) break; @@ -916,3 +906,27 @@ int32_t httpParserBuf(HttpContext *pContext, HttpParserObj *parser, const char * return ret; } + +void httpParserCleanupString(HttpParserString *str) { + free(str->str); + str->str = NULL; + str->len = 0; +} + +int32_t httpParserAppendString(HttpParserString *str, const char *s, int32_t len) { + int32_t n = str->len; + char *p = (char*)realloc(str->str, n + len + 1); + if (!p) return -1; + strncpy(p+n, s, len); + p[n+len] = '\0'; + str->str = p; + str->len = n+len; + return 0; +} + +void httpParserClearString(HttpParserString *str) { + if (str->str) { + str->str[0] = '\0'; + str->len = 0; + } +} diff --git a/src/plugins/http/src/restHandle.c b/src/plugins/http/src/httpRestHandle.c similarity index 98% rename from src/plugins/http/src/restHandle.c rename to src/plugins/http/src/httpRestHandle.c index 8f998420de..b285b19c3f 100644 --- a/src/plugins/http/src/restHandle.c +++ b/src/plugins/http/src/httpRestHandle.c @@ -16,8 +16,8 @@ #define _DEFAULT_SOURCE #include "os.h" #include "httpLog.h" -#include "restHandle.h" -#include "restJson.h" +#include "httpRestHandle.h" +#include "httpRestJson.h" static HttpDecodeMethod restDecodeMethod = {"rest", restProcessRequest}; static HttpDecodeMethod restDecodeMethod2 = {"restful", restProcessRequest}; diff --git a/src/plugins/http/src/restJson.c b/src/plugins/http/src/httpRestJson.c similarity index 99% rename from src/plugins/http/src/restJson.c rename to src/plugins/http/src/httpRestJson.c index 4a7836ad7a..c16727faa0 100644 --- a/src/plugins/http/src/restJson.c +++ b/src/plugins/http/src/httpRestJson.c @@ -18,8 +18,8 @@ #include "tglobal.h" #include "httpLog.h" #include "httpJson.h" -#include "restHandle.h" -#include "restJson.h" +#include "httpRestHandle.h" +#include "httpRestJson.h" void restBuildSqlAffectRowsJson(HttpContext *pContext, HttpSqlCmd *cmd, int affect_rows) { JsonBuf *jsonBuf = httpMallocJsonBuf(pContext); diff --git a/src/plugins/http/src/httpServer.c b/src/plugins/http/src/httpServer.c index b42e2cb0aa..e0d2a90994 100644 --- a/src/plugins/http/src/httpServer.c +++ b/src/plugins/http/src/httpServer.c @@ -25,8 +25,6 @@ #include "httpResp.h" #include "httpUtil.h" -#include "elog.h" - #ifndef EPOLLWAKEUP #define EPOLLWAKEUP (1u << 29) #endif @@ -334,7 +332,7 @@ bool httpInitConnect() { static bool httpReadData(HttpContext *pContext) { HttpParser *pParser = &pContext->parser; - EQ_ASSERT(!pContext->parsed); + ASSERT(!pContext->parsed); if (!pParser->parser) { if (!pParser->inited) { diff --git a/src/plugins/http/src/httpSystem.c b/src/plugins/http/src/httpSystem.c index e51c8dd4f7..ee43b3c826 100644 --- a/src/plugins/http/src/httpSystem.c +++ b/src/plugins/http/src/httpSystem.c @@ -27,9 +27,9 @@ #include "httpResp.h" #include "httpHandle.h" #include "httpQueue.h" -#include "gcHandle.h" -#include "restHandle.h" -#include "tgHandle.h" +#include "httpGcHandle.h" +#include "httpRestHandle.h" +#include "httpTgHandle.h" #ifndef _ADMIN void adminInitHandle(HttpServer* pServer) {} diff --git a/src/plugins/http/src/tgHandle.c b/src/plugins/http/src/httpTgHandle.c similarity index 99% rename from src/plugins/http/src/tgHandle.c rename to src/plugins/http/src/httpTgHandle.c index 84d7d13fde..a7444676ae 100644 --- a/src/plugins/http/src/tgHandle.c +++ b/src/plugins/http/src/httpTgHandle.c @@ -19,8 +19,8 @@ #include "taosdef.h" #include "taosmsg.h" #include "httpInt.h" -#include "tgHandle.h" -#include "tgJson.h" +#include "httpTgHandle.h" +#include "httpTgJson.h" #include "cJSON.h" /* diff --git a/src/plugins/http/src/tgJson.c b/src/plugins/http/src/httpTgJson.c similarity index 99% rename from src/plugins/http/src/tgJson.c rename to src/plugins/http/src/httpTgJson.c index 170a1b343e..5c6985cd69 100644 --- a/src/plugins/http/src/tgJson.c +++ b/src/plugins/http/src/httpTgJson.c @@ -19,8 +19,8 @@ #include "httpLog.h" #include "httpJson.h" #include "httpResp.h" -#include "tgHandle.h" -#include "tgJson.h" +#include "httpTgHandle.h" +#include "httpTgJson.h" void tgInitQueryJson(HttpContext *pContext) { JsonBuf *jsonBuf = httpMallocJsonBuf(pContext); diff --git a/src/util/inc/elog.h b/src/util/inc/elog.h deleted file mode 100644 index 8e11c3e761..0000000000 --- a/src/util/inc/elog.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _elog_h_8897be44_dda8_45b6_9d37_8d8691cb05fb_ -#define _elog_h_8897be44_dda8_45b6_9d37_8d8691cb05fb_ - -#include - -typedef enum { - ELOG_DEBUG, - ELOG_INFO, - ELOG_WARN, - ELOG_ERROR, - ELOG_CRITICAL, - ELOG_VERBOSE, - ELOG_ABORT, -} ELOG_LEVEL; - -void elog_set_level(ELOG_LEVEL base); // only log those not less than base -void elog_set_thread_name(const char *name); - -void elog(ELOG_LEVEL level, int fd, const char *file, int line, const char *func, const char *fmt, ...) -#ifdef __GNUC__ - __attribute__((format(printf, 6, 7))) -#endif -; - -#define DLOG(fd, fmt, ...) elog(ELOG_DEBUG, fd, __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) -#define ILOG(fd, fmt, ...) elog(ELOG_INFO, fd, __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) -#define WLOG(fd, fmt, ...) elog(ELOG_WARN, fd, __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) -#define ELOG(fd, fmt, ...) elog(ELOG_ERROR, fd, __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) -#define CLOG(fd, fmt, ...) elog(ELOG_CRITICAL, fd, __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) -#define VLOG(fd, fmt, ...) elog(ELOG_VERBOSE, fd, __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) -#define ALOG(fd, fmt, ...) elog(ELOG_ABORT, fd, __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) - -#define D(fmt, ...) elog(ELOG_DEBUG, fileno(stdout), __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) -#define I(fmt, ...) elog(ELOG_INFO, fileno(stdout), __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) -#define W(fmt, ...) elog(ELOG_WARN, fileno(stdout), __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) -#define E(fmt, ...) elog(ELOG_ERROR, fileno(stdout), __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) -#define C(fmt, ...) elog(ELOG_CRITICAL, fileno(stdout), __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) -#define V(fmt, ...) elog(ELOG_VERBOSE, fileno(stdout), __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) -#define A(fmt, ...) elog(ELOG_ABORT, fileno(stdout), __FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__) - - - -// NOTE: https://en.wikipedia.org/wiki/Fail-fast -// for the sake of simplicity, both implementation and usage, -// we'll follow `fail-fast` or `let-it-crash` philosophy. - -// assertion in both debug/release build -#define EQ_ABORT(fmt, ...) A("Assertion failure: "fmt, ##__VA_ARGS__) - -#define EQ_ASSERT(statement) do { \ - if (statement) break; \ - A("Assertion failure: %s", #statement); \ -} while (0) - -#define EQ_ASSERT_EXT(statement, fmt, ...) do { \ - if (statement) break; \ - A("Assertion failure: %s: "fmt, #statement, ##__VA_ARGS__); \ -} while (0) - -#define EQ_ASSERT_API0(statement) do { \ - if (statement) break; \ - A("Assertion failure: %s failed: [%d]%s", #statement, errno, strerror(errno)); \ -} while (0) - -#define EQ_ASSERT_API(api) do { \ - A("Assertion failure: %s failed: [%d]%s", #api, errno, strerror(errno)); \ -} while (0) - - -#endif // _elog_h_8897be44_dda8_45b6_9d37_8d8691cb05fb_ - diff --git a/src/util/src/elog.c b/src/util/src/elog.c deleted file mode 100644 index 95b580962c..0000000000 --- a/src/util/src/elog.c +++ /dev/null @@ -1,95 +0,0 @@ -#include "elog.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#define gettid() syscall(__NR_gettid) - -static ELOG_LEVEL elog_level_base = ELOG_DEBUG; - -static __thread long elog_thread_id; -static __thread char elog_thread_name[24] = {0}; - -void elog_set_level(ELOG_LEVEL base) { - elog_level_base = base; -} - -void elog_set_thread_name(const char *name) { - elog_thread_id = gettid(); - snprintf(elog_thread_name, sizeof(elog_thread_name), "%s", name); -} - -void elog(ELOG_LEVEL level, int fd, const char *file, int line, const char *func, const char *fmt, ...) -{ - if (level < elog_level_base) return; - if (fd == -1) return; - - if (elog_thread_name[0]=='\0') { - elog_set_thread_name("unknown"); - } - - char *p; - int n; - size_t bytes; - - char buf[4096]; - snprintf(buf, sizeof(buf), "%s", file); - - char fn[1024]; - snprintf(fn, sizeof(fn), "%s", basename(buf)); - - char C; - switch (level) { - case ELOG_DEBUG: C = 'D'; break; - case ELOG_INFO: C = 'I'; break; - case ELOG_WARN: C = 'W'; break; - case ELOG_ERROR: C = 'E'; break; - case ELOG_CRITICAL: C = 'C'; break; - case ELOG_VERBOSE: C = 'V'; break; - case ELOG_ABORT: C = 'A'; break; - default: return; - } - - struct tm t; - struct timeval tv; - - if (gettimeofday(&tv, NULL)) return; - if (!localtime_r(&tv.tv_sec, &t)) return; - - p = buf; - bytes = sizeof(buf); - - n = snprintf(p, bytes, "%c[%02d/%02d %02d:%02d:%02d.%06ld][%06ld]: ==", - C, - t.tm_mon + 1, t.tm_mday, - t.tm_hour, t.tm_min, t.tm_sec, - tv.tv_usec, - elog_thread_id); - p += n; bytes -= n; - - va_list arg; - va_start(arg, fmt); - if (bytes>0) { - n = vsnprintf(p, bytes, fmt, arg); - p += n; bytes -= n; - } - va_end(arg); - - if (bytes>0) { - n = snprintf(p, bytes, "== t:%s#%s[%d]#%s()", - elog_thread_name, fn, line, func); - } - - dprintf(fd, "%s\n", buf); - - if (level == ELOG_ABORT) { - abort(); - } -} - -- GitLab