From 0278ee5f0443a283b2b6f6f70e19781e00f46d7e Mon Sep 17 00:00:00 2001 From: laforge Date: Sat, 23 Aug 2003 17:37:53 +0000 Subject: remove unused functions/variables, fix wrong printf paramtypes (-Wall) --- ulogd/mysql/ulogd_MYSQL.c | 28 +++++++--------------------- ulogd/pgsql/ulogd_PGSQL.c | 24 +++++------------------- 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/ulogd/mysql/ulogd_MYSQL.c b/ulogd/mysql/ulogd_MYSQL.c index 1beba4c..48bb8d6 100644 --- a/ulogd/mysql/ulogd_MYSQL.c +++ b/ulogd/mysql/ulogd_MYSQL.c @@ -1,4 +1,4 @@ -/* ulogd_MYSQL.c, Version $Revision: 1.11 $ +/* ulogd_MYSQL.c, Version $Revision: 1.12 $ * * ulogd output plugin for logging to a MySQL database * @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: ulogd_MYSQL.c,v 1.11 2003/08/23 11:40:54 laforge Exp $ + * $Id: ulogd_MYSQL.c,v 1.12 2003/08/23 11:47:32 laforge Exp $ * * 15 May 2001, Alex Janssen : * Added a compability option for older MySQL-servers, which @@ -85,26 +85,12 @@ static config_entry_t table_ce = { &pass_ce, "mysqltable", CONFIG_TYPE_STRING, CONFIG_OPT_MANDATORY, 0, { } }; -/* is the given string a field in our table? */ -static int is_field(const char *name) -{ - struct _field *f; - - for (f = fields; f; f = f->next) { - if (!strcmp(f->name, name)) - return 1; - } - return 0; -} - /* our main output function, called by ulogd */ static int _mysql_output(ulog_iret_t *result) { struct _field *f; ulog_iret_t *res; - char *tmpstr; - stmt_ins = stmt_val; for (f = fields; f; f = f->next) { @@ -133,7 +119,7 @@ static int _mysql_output(ulog_iret_t *result) sprintf(stmt_ins, "%d,", res->value.i32); break; case ULOGD_RET_INT64: - sprintf(stmt_ins, "%ld,", res->value.i64); + sprintf(stmt_ins, "%lld,", res->value.i64); break; case ULOGD_RET_UINT8: sprintf(stmt_ins, "%u,", res->value.ui8); @@ -163,7 +149,7 @@ static int _mysql_output(ulog_iret_t *result) sprintf(stmt_ins, "%u,", res->value.ui32); break; case ULOGD_RET_UINT64: - sprintf(stmt_ins, "%lu,", res->value.ui64); + sprintf(stmt_ins, "%llu,", res->value.ui64); break; case ULOGD_RET_BOOL: sprintf(stmt_ins, "'%d',", res->value.b); @@ -243,7 +229,7 @@ static int _mysql_createstmt(void) for (f = fields; f; f = f->next) { strncpy(buf, f->name, ULOGD_MAX_KEYLEN); - while (underscore = strchr(buf, '.')) + while ((underscore = strchr(buf, '.'))) *underscore = '_'; sprintf(stmt_val, "%s,", buf); stmt_val = stmt + strlen(stmt); @@ -275,11 +261,11 @@ static int _mysql_get_columns(const char *table) if (!result) return 1; - while (field = mysql_fetch_field(result)) { + while ((field = mysql_fetch_field(result))) { /* replace all underscores with dots */ strncpy(buf, field->name, ULOGD_MAX_KEYLEN); - while (underscore = strchr(buf, '_')) + while ((underscore = strchr(buf, '_'))) *underscore = '.'; DEBUGP("field '%s' found: ", buf); diff --git a/ulogd/pgsql/ulogd_PGSQL.c b/ulogd/pgsql/ulogd_PGSQL.c index 084ac95..7ac5084 100644 --- a/ulogd/pgsql/ulogd_PGSQL.c +++ b/ulogd/pgsql/ulogd_PGSQL.c @@ -1,4 +1,4 @@ -/* ulogd_PGSQL.c, Version $Revision: 1.5 $ +/* ulogd_PGSQL.c, Version $Revision: 1.6 $ * * ulogd output plugin for logging to a PGSQL database * @@ -65,18 +65,6 @@ static config_entry_t table_ce = { &pass_ce, "pgsqltable", CONFIG_TYPE_STRING, CONFIG_OPT_MANDATORY, 0, { } }; -/* is the given string a field in our table? */ -static int is_field(const char *name) -{ - struct _field *f; - - for (f = fields; f; f = f->next) { - if (!strcmp(f->name, name)) - return 1; - } - return 0; -} - /* our main output function, called by ulogd */ static int _pgsql_output(ulog_iret_t *result) { @@ -84,8 +72,6 @@ static int _pgsql_output(ulog_iret_t *result) ulog_iret_t *res; PGresult *pgres; - char *tmpstr; - stmt_ins = stmt_val; for (f = fields; f; f = f->next) { @@ -114,7 +100,7 @@ static int _pgsql_output(ulog_iret_t *result) sprintf(stmt_ins, "%d,", res->value.i32); break; case ULOGD_RET_INT64: - sprintf(stmt_ins, "%ld,", res->value.i64); + sprintf(stmt_ins, "%lld,", res->value.i64); break; case ULOGD_RET_UINT8: sprintf(stmt_ins, "%u,", res->value.ui8); @@ -138,7 +124,7 @@ static int _pgsql_output(ulog_iret_t *result) sprintf(stmt_ins, "%u,", res->value.ui32); break; case ULOGD_RET_UINT64: - sprintf(stmt_ins, "%lu,", res->value.ui64); + sprintf(stmt_ins, "%llu,", res->value.ui64); break; case ULOGD_RET_BOOL: sprintf(stmt_ins, "'%d',", res->value.b); @@ -216,7 +202,7 @@ static int _pgsql_createstmt(void) for (f = fields; f; f = f->next) { strncpy(buf, f->name, ULOGD_MAX_KEYLEN); - while (underscore = strchr(buf, '.')) + while ((underscore = strchr(buf, '.'))) *underscore = '_'; sprintf(stmt_val, "%s,", buf); stmt_val = stmt + strlen(stmt); @@ -265,7 +251,7 @@ static int _pgsql_get_columns(const char *table) /* replace all underscores with dots */ strncpy(buf, PQgetvalue(result, intaux, 0), ULOGD_MAX_KEYLEN); - while (underscore = strchr(buf, '_')) + while ((underscore = strchr(buf, '_'))) *underscore = '.'; DEBUGP("field '%s' found: ", buf); -- cgit v1.2.3