summaryrefslogtreecommitdiff
path: root/libmysqlpp/my-command.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-02-16 14:20:26 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2019-02-16 14:20:26 +0000
commitb8ddecf41c8938136b3f4a081e1b8a98584c2401 (patch)
tree6813f5fbf3e5ad4f0e8e0d49eb9c9d4d0cfe3003 /libmysqlpp/my-command.cpp
parentBasic clang tidy fixes (diff)
downloadlibdbpp-mysql-b8ddecf41c8938136b3f4a081e1b8a98584c2401.tar.bz2
libdbpp-mysql-b8ddecf41c8938136b3f4a081e1b8a98584c2401.tar.xz
libdbpp-mysql-b8ddecf41c8938136b3f4a081e1b8a98584c2401.zip
Modernize clang tidy fixes
Diffstat (limited to 'libmysqlpp/my-command.cpp')
-rw-r--r--libmysqlpp/my-command.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/libmysqlpp/my-command.cpp b/libmysqlpp/my-command.cpp
index 4ad00fc..c296be4 100644
--- a/libmysqlpp/my-command.cpp
+++ b/libmysqlpp/my-command.cpp
@@ -1,7 +1,7 @@
#include "my-command.h"
#include "my-connection.h"
-#include <stdlib.h>
-#include <string.h>
+#include <cstdlib>
+#include <cstring>
MySQL::Command::Command(const Connection * conn, const std::string & sql) :
DB::Command(sql),
@@ -18,17 +18,17 @@ MySQL::Command::Command(const Connection * conn, const std::string & sql) :
binds.resize(mysql_stmt_param_count(stmt));
if (binds.size()) {
paramsNeedBinding = true;
- for (Binds::iterator i = binds.begin(); i != binds.end(); ++i) {
- memset(&*i, 0, sizeof(MYSQL_BIND));
- i->buffer_type = MYSQL_TYPE_NULL;
+ for (auto & b : binds) {
+ memset(&b, 0, sizeof(MYSQL_BIND));
+ b.buffer_type = MYSQL_TYPE_NULL;
}
}
}
MySQL::Command::~Command()
{
- for (Binds::const_iterator i = binds.begin(); i != binds.end(); ++i) {
- free(i->buffer);
+ for (auto & b : binds) {
+ free(b.buffer);
}
mysql_stmt_close(stmt);
}
@@ -162,7 +162,7 @@ void
MySQL::Command::bindNull(unsigned int n)
{
binds[n].buffer_type = MYSQL_TYPE_NULL;
- binds[n].buffer = NULL;
+ binds[n].buffer = nullptr;
free(binds[n].buffer);
}