Minor improvement to 'setErrMsg'

1. code like `char msg[] = "xxxxxx"` unnecessarily copied the string to stack, changed to `const char* msg = "xxxxxx"`.
2. the 2rd argument of `setErrMsg` is changed from `char*` to `const char*`.
3. the 3rd argument of `setErrMsg` is removed as `strncpy` stops copying at the end of source string.
This commit is contained in:
localvar 2019-07-26 13:27:12 +08:00
parent 4dcf8d7fce
commit b2e06d1c0b
2 changed files with 327 additions and 328 deletions

View File

@ -348,7 +348,7 @@ int32_t tsParseOneColumnData(SSchema* pSchema, char* value, int valuelen, char*
// todo merge the error msg function with tSQLParser
static void setErrMsg(char* msg, char* sql) {
char msgFormat[] = "near \"%s\" syntax error";
const char* msgFormat = "near \"%s\" syntax error";
const int32_t BACKWARD_CHAR_STEP = 15;
// only extract part of sql string,avoid too long sql string cause stack over flow

File diff suppressed because it is too large Load Diff