]> granicus.if.org Git - postgresql/commitdiff
Suppress possibly-uninitialized-variable warning seen with older gcc versions.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 24 Jan 2012 18:40:26 +0000 (13:40 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 24 Jan 2012 18:40:26 +0000 (13:40 -0500)
src/backend/postmaster/pgstat.c

index 3ab8dfe065b0fc5f12155060c2b4eccf7d6e7876..e5bafd3c2d552d54776d89d2518497ae9352fa73 100644 (file)
@@ -2490,7 +2490,7 @@ pgstat_report_activity(BackendState state, const char *cmd_str)
        volatile PgBackendStatus *beentry = MyBEEntry;
        TimestampTz start_timestamp;
        TimestampTz current_timestamp;
-       int                     len;
+       int                     len = 0;
 
        TRACE_POSTGRESQL_STATEMENT_STATUS(cmd_str);
 
@@ -2524,8 +2524,8 @@ pgstat_report_activity(BackendState state, const char *cmd_str)
        start_timestamp = GetCurrentStatementStartTimestamp();
        if (cmd_str != NULL)
        {
-               len = strlen(cmd_str);
-               len = pg_mbcliplen(cmd_str, len, pgstat_track_activity_query_size - 1);
+               len = pg_mbcliplen(cmd_str, strlen(cmd_str),
+                                                  pgstat_track_activity_query_size - 1);
        }
 
        /*