Skip to content

Commit

Permalink
Fix some cppcheck reports: (#11)
Browse files Browse the repository at this point in the history
* Fix some cppcheck reports:

[ma_desc.c:107] -> [ma_desc.c:104]: (warning) Either the condition 'Desc' is redundant or there is possible null pointer dereference: Desc.
[ma_parse.c:45]: (style) Variable 'p' is assigned a value that is never used.
[ma_parse.c:46]: (style) Variable 'Tokens' is assigned a value that is never used.
[ma_statement.c:113]: (style) Variable 'NewStmt' is assigned a value that is never used.
[ma_statement.c:444]: (style) Variable 'Length' is assigned a value that is never used.
[ma_statement.c:1315] -> [ma_statement.c:1318]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_statement.c:1798] -> [ma_statement.c:1802]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_statement.c:1799] -> [ma_statement.c:1802]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_string.c:88]: (style) Variable 'Count' is assigned a value that is never used.

* Fix some cppcheck reports:

[ma_desc.c:107] -> [ma_desc.c:104]: (warning) Either the condition 'Desc' is redundant or there is possible null pointer dereference: Desc.
[ma_parse.c:45]: (style) Variable 'p' is assigned a value that is never used.
[ma_parse.c:46]: (style) Variable 'Tokens' is assigned a value that is never used.
[ma_statement.c:113]: (style) Variable 'NewStmt' is assigned a value that is never used.
[ma_statement.c:444]: (style) Variable 'Length' is assigned a value that is never used.
[ma_statement.c:1315] -> [ma_statement.c:1318]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_statement.c:1798] -> [ma_statement.c:1802]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_statement.c:1799] -> [ma_statement.c:1802]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_string.c:88]: (style) Variable 'Count' is assigned a value that is never used.

All of my past & future contributions to MariaDB may be
licensed under the BSD-new license.

* Fix some cppcheck reports:

[ma_desc.c:107] -> [ma_desc.c:104]: (warning) Either the condition 'Desc' is redundant or there is possible null pointer dereference: Desc.
[ma_parse.c:45]: (style) Variable 'p' is assigned a value that is never used.
[ma_parse.c:46]: (style) Variable 'Tokens' is assigned a value that is never used.
[ma_statement.c:113]: (style) Variable 'NewStmt' is assigned a value that is never used.
[ma_statement.c:444]: (style) Variable 'Length' is assigned a value that is never used.
[ma_statement.c:1315] -> [ma_statement.c:1318]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_statement.c:1798] -> [ma_statement.c:1802]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_statement.c:1799] -> [ma_statement.c:1802]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_string.c:88]: (style) Variable 'Count' is assigned a value that is never used.

All of my past & future contributions to MariaDB may be
licensed under the BSD-new license.

* Fix some cppcheck reports:

[ma_desc.c:107] -> [ma_desc.c:104]: (warning) Either the condition 'Desc' is redundant or there is possible null pointer dereference: Desc.
[ma_parse.c:45]: (style) Variable 'p' is assigned a value that is never used.
[ma_parse.c:46]: (style) Variable 'Tokens' is assigned a value that is never used.
[ma_statement.c:113]: (style) Variable 'NewStmt' is assigned a value that is never used.
[ma_statement.c:444]: (style) Variable 'Length' is assigned a value that is never used.
[ma_statement.c:1315] -> [ma_statement.c:1318]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_statement.c:1798] -> [ma_statement.c:1802]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_statement.c:1799] -> [ma_statement.c:1802]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_string.c:88]: (style) Variable 'Count' is assigned a value that is never used.

All of my past & future contributions to MariaDB may be
licensed under the BSD-new license.

* Fix some cppcheck reports:

[ma_desc.c:107] -> [ma_desc.c:104]: (warning) Either the condition 'Desc' is redundant or there is possible null pointer dereference: Desc.
[ma_parse.c:45]: (style) Variable 'p' is assigned a value that is never used.
[ma_parse.c:46]: (style) Variable 'Tokens' is assigned a value that is never used.
[ma_statement.c:113]: (style) Variable 'NewStmt' is assigned a value that is never used.
[ma_statement.c:444]: (style) Variable 'Length' is assigned a value that is never used.
[ma_statement.c:1315] -> [ma_statement.c:1318]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_statement.c:1798] -> [ma_statement.c:1802]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_statement.c:1799] -> [ma_statement.c:1802]: (warning) Either the condition '!Stmt' is redundant or there is possible null pointer dereference: Stmt.
[ma_string.c:88]: (style) Variable 'Count' is assigned a value that is never used.

All of my past & future contributions to MariaDB may be
licensed under the BSD-new license.
  • Loading branch information
serval2412 authored and lawrinn committed Oct 15, 2016
1 parent 8b2f543 commit 4705b82
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
8 changes: 3 additions & 5 deletions ma_desc.c
Expand Up @@ -84,14 +84,14 @@ MADB_Desc *MADB_DescInit(MADB_Dbc *Dbc,enum enum_madb_desc_type DescType, my_boo
if (my_init_dynamic_array(&Desc->Records, sizeof(MADB_DescRecord), 0, 0))
{
MADB_FREE(Desc);
Desc= NULL;
return NULL;
}
if (isExternal)
{
if (my_init_dynamic_array(&Desc->Stmts, sizeof(MADB_Stmt**), 0, 0))
{
MADB_DescFree(Desc, FALSE);
Desc= NULL;
return NULL;
}
else
{
Expand All @@ -101,9 +101,7 @@ MADB_Desc *MADB_DescInit(MADB_Dbc *Dbc,enum enum_madb_desc_type DescType, my_boo
Dbc->Descrs= list_add(Dbc->Descrs, &Desc->ListItem);
}
}
if (Desc)
Desc->AppType= isExternal;

Desc->AppType= isExternal;
Desc->Header.ArraySize= 1;

return Desc;
Expand Down
2 changes: 0 additions & 2 deletions ma_parse.c
Expand Up @@ -42,8 +42,6 @@ MADB_QUERY *MADB_Tokenize(const char *Stmt)
const char *End= (char *)Stmt + strlen(Stmt);
const char *Pos;
const char *Start= Stmt;
const char *p= Stmt;
int Tokens= 0;

MADB_QUERY *Query= (MADB_QUERY *)MADB_CALLOC(sizeof(MADB_QUERY));
init_dynamic_array(&Query->tokens, sizeof(unsigned int), 20, 20);
Expand Down
10 changes: 2 additions & 8 deletions ma_statement.c
Expand Up @@ -110,8 +110,6 @@ SQLRETURN MADB_ExecuteQuery(MADB_Stmt * Stmt, char *StatementText, SQLINTEGER Te
/* {{{ MADB_StmtBulkOperations */
SQLRETURN MADB_StmtBulkOperations(MADB_Stmt *Stmt, SQLSMALLINT Operation)
{
SQLHSTMT NewStmt= NULL;

MADB_CLEAR_ERROR(&Stmt->Error);
switch(Operation)
{
Expand Down Expand Up @@ -441,7 +439,6 @@ SQLRETURN MADB_StmtPrepare(MADB_Stmt *Stmt, char *StatementText, SQLINTEGER Text

if ((CursorName = MADB_ParseCursorName(Stmt, &WhereOffset)))
{
unsigned int Length= WhereOffset + 10;
DYNAMIC_STRING StmtStr;
char *TableName;

Expand Down Expand Up @@ -1315,9 +1312,6 @@ SQLRETURN MADB_StmtBindCol(MADB_Stmt *Stmt, SQLUSMALLINT ColumnNumber, SQLSMALLI
MADB_Desc *Ard= Stmt->Ard;
MADB_DescRecord *Record;

if (!Stmt)
return SQL_INVALID_HANDLE;

if ((ColumnNumber < 1 && Stmt->Options.UseBookmarks == SQL_UB_OFF) ||
(mysql_stmt_field_count(Stmt->stmt) &&
Stmt->stmt->state > MYSQL_STMT_PREPARED &&
Expand Down Expand Up @@ -1796,10 +1790,10 @@ SQLRETURN MADB_StmtFetch(MADB_Stmt *Stmt, my_bool KeepPosition)
{
unsigned int j, rc;
SQLULEN ArraySize= Stmt->Ard->Header.ArraySize;
MADB_Desc *ArdDesc= Stmt->Ard;
MADB_Desc *ArdDesc= Stmt->Ard;
MYSQL_ROWS *SaveCursor= NULL;

if (!Stmt || !Stmt->stmt)
if (!Stmt->stmt)
return SQL_INVALID_HANDLE;

MADB_CLEAR_ERROR(&Stmt->Error);
Expand Down
2 changes: 1 addition & 1 deletion ma_string.c
Expand Up @@ -85,7 +85,7 @@ my_bool MADB_DynStrAppendQuoted(DYNAMIC_STRING *DynString, char *String)

my_bool MADB_DynStrUpdateSet(MADB_Stmt *Stmt, DYNAMIC_STRING *DynString)
{
int i, IgnoredColumns= 0, Count= 0;
int i, IgnoredColumns= 0;
MADB_DescRecord *Record;

if (dynstr_append(DynString, " SET "))
Expand Down

0 comments on commit 4705b82

Please sign in to comment.