summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/extra/m_mssql.cpp8
-rw-r--r--src/modules/extra/m_mysql.cpp8
-rw-r--r--src/modules/extra/m_pgsql.cpp8
-rw-r--r--src/modules/extra/m_sqlite3.cpp8
4 files changed, 12 insertions, 20 deletions
diff --git a/src/modules/extra/m_mssql.cpp b/src/modules/extra/m_mssql.cpp
index 65f86e9ac..0b197efe5 100644
--- a/src/modules/extra/m_mssql.cpp
+++ b/src/modules/extra/m_mssql.cpp
@@ -37,12 +37,10 @@ typedef std::deque<MsSQLResult*> ResultQueue;
unsigned long count(const char * const str, char a)
{
unsigned long n = 0;
- const char *p = reinterpret_cast<const char *>(str);
-
- while ((p = strchr(p, a)) != NULL)
+ for (const char *p = reinterpret_cast<const char *>(str); *p; ++p)
{
- ++p;
- ++n;
+ if (*p == '?')
+ ++n;
}
return n;
}
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index 339f13309..a25234909 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -77,12 +77,10 @@ class DispatcherThread;
unsigned long count(const char * const str, char a)
{
unsigned long n = 0;
- const char *p = reinterpret_cast<const char *>(str);
-
- while ((p = strchr(p, a)) != NULL)
+ for (const char *p = reinterpret_cast<const char *>(str); *p; ++p)
{
- ++p;
- ++n;
+ if (*p == '?')
+ ++n;
}
return n;
}
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 0484646df..526f1a51f 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -47,12 +47,10 @@ enum SQLstatus { CREAD, CWRITE, WREAD, WWRITE, RREAD, RWRITE };
unsigned long count(const char * const str, char a)
{
unsigned long n = 0;
- const char *p = reinterpret_cast<const char *>(str);
-
- while ((p = strchr(p, a)) != NULL)
+ for (const char *p = reinterpret_cast<const char *>(str); *p; ++p)
{
- ++p;
- ++n;
+ if (*p == '?')
+ ++n;
}
return n;
}
diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp
index d174ce8aa..c4d1cc799 100644
--- a/src/modules/extra/m_sqlite3.cpp
+++ b/src/modules/extra/m_sqlite3.cpp
@@ -34,12 +34,10 @@ typedef std::deque<SQLite3Result*> ResultQueue;
unsigned long count(const char * const str, char a)
{
unsigned long n = 0;
- const char *p = reinterpret_cast<const char *>(str);
-
- while ((p = strchr(p, a)) != NULL)
+ for (const char *p = reinterpret_cast<const char *>(str); *p; ++p)
{
- ++p;
- ++n;
+ if (*p == '?')
+ ++n;
}
return n;
}