MXS-2268: Fix undefined behavior

Using a void return value as an integer results in undefined behavior.
apparently in this case it doesn't translate into a crash and instead only
manifests itself when all the planets align.
This commit is contained in:
Markus Mäkelä
2019-02-06 22:36:12 +02:00
parent a9f6955fc8
commit 994bfcd285

View File

@ -3282,7 +3282,7 @@ extern void maxscale_update_function_info(const char* name, const Expr* pExpr);
// 'unsigned int' and not 'uint32_t' because 'uint32_t' is unknown in sqlite3 context. // 'unsigned int' and not 'uint32_t' because 'uint32_t' is unknown in sqlite3 context.
extern void maxscale_set_type_mask(unsigned int type_mask); extern void maxscale_set_type_mask(unsigned int type_mask);
extern void maxscaleComment(); extern int maxscaleComment();
extern int maxscaleKeyword(int token); extern int maxscaleKeyword(int token);
extern int maxscaleTranslateKeyword(int token); extern int maxscaleTranslateKeyword(int token);
@ -4080,14 +4080,18 @@ void maxscaleCreateSequence(Parse* pParse, Token* pDatabase, Token* pTable)
QC_EXCEPTION_GUARD(pInfo->maxscaleCreateSequence(pParse, pDatabase, pTable)); QC_EXCEPTION_GUARD(pInfo->maxscaleCreateSequence(pParse, pDatabase, pTable));
} }
void maxscaleComment() int maxscaleComment()
{ {
QC_TRACE(); QC_TRACE();
QcSqliteInfo* pInfo = this_thread.pInfo; QcSqliteInfo* pInfo = this_thread.pInfo;
ss_dassert(pInfo); ss_dassert(pInfo);
QC_EXCEPTION_GUARD(pInfo->maxscaleComment()); int rc = 0;
QC_EXCEPTION_GUARD(rc = pInfo->maxscaleComment());
return rc;
} }
void maxscaleDeclare(Parse* pParse) void maxscaleDeclare(Parse* pParse)