]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
remove unused functions/variables, fix wrong printf paramtypes (-Wall)
authorlaforge <laforge>
Sat, 23 Aug 2003 17:37:53 +0000 (17:37 +0000)
committerlaforge <laforge>
Sat, 23 Aug 2003 17:37:53 +0000 (17:37 +0000)
mysql/ulogd_MYSQL.c
pgsql/ulogd_PGSQL.c

index 1beba4ccbd3869562a9d97c284a0ffadd0da74b5..48bb8d6df9432304d837facde18a252430c78de1 100644 (file)
@@ -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 <alex@ynfonatic.de>:
  *      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);
index 084ac95f77f4de27054dfb7ce5a6848164b41f63..7ac5084deb85af6a9f92f94233e984badefc7e3c 100644 (file)
@@ -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);