Fixing several compiler warnings (unused and
authorJan Wieck <JanWieck@Yahoo.com>
Mon, 27 May 2013 14:45:56 +0000 (10:45 -0400)
committerJan Wieck <JanWieck@Yahoo.com>
Mon, 27 May 2013 14:45:56 +0000 (10:45 -0400)
possibly used uninitialized things).

src/slon/monitor_thread.c
src/slon/remote_worker.c
src/slonik/slonik.c
src/slony_logshipper/slony_logshipper.c

index 29d7b1e381e70321d7e6089ec3f055ac769a93b3..5d4e546eeb5d1d41e13a7d20a998b9abe91a2a7e 100644 (file)
 
 static void stack_init(void);
 static bool stack_pop(SlonState * current);
+#ifdef UNUSED
 static void stack_dump();
 static void entry_dump(int i, SlonState * tos);
+#endif
 static int     initial_stack_size = 6;
 
 /* ----------
@@ -427,6 +429,7 @@ stack_pop( /* @out@ */ SlonState * qentry)
        }
 }
 
+#ifdef UNUSED
 static void
 stack_dump()
 {
@@ -457,3 +460,4 @@ entry_dump(int i, SlonState * tos)
        slon_log(SLON_DEBUG2, "actor[%s] activity[%s] event_type[%s]\n",
                         tos->actor, tos->activity, tos->event_type);
 }
+#endif /* UNUSED */
index d7f1ad8ecadac92a1032715d1fc73324a7f88eae..e3c71a51de055cddfd58383d0ba2cfe3fab261b0 100644 (file)
@@ -273,7 +273,9 @@ static int  archive_append_data(SlonNode * node, const char *s, int len);
 
 static void compress_actionseq(const char *ssy_actionseq, SlonDString * action_subquery);
 
+#ifdef UNUSED
 static int     check_set_subscriber(int set_id, int node_id, PGconn *local_dbconn);
+#endif
 
 /* ----------
  * slon_remoteWorkerThread
@@ -5443,6 +5445,7 @@ compress_actionseq(const char *ssy_actionlist, SlonDString * action_subquery)
        slon_log(SLON_DEBUG4, " compressed actionseq subquery... %s\n", dstring_data(action_subquery));
 }
 
+#ifdef UNUSED
 /**
  * Checks to see if the node specified is a member of the set.
  *
@@ -5474,6 +5477,7 @@ check_set_subscriber(int set_id, int node_id, PGconn *local_dbconn)
        PQclear(res);
        return 1;
 }
+#endif /* UNUSED */
 
 static void
 init_perfmon(PerfMon * perf_info)
index e3c53735a8590b127d98064881f748e4be730c1c..6779cfe51f5d3da5f6e4750c3b9408c648aead6e 100644 (file)
@@ -2646,7 +2646,7 @@ slonik_drop_node(SlonikStmt_drop_node * stmt)
 
                                        }
                                        adminfo2->last_event = ev_id;
-                                       printf("debug: waiting for %d,%ld on %d\n",
+                                       printf("debug: waiting for %d," INT64_FORMAT " on %d\n",
                                                   wait_event.wait_origin, ev_id, wait_event.wait_on);
                                        rc = slonik_wait_event(&wait_event);
                                        if (rc < 0)
@@ -6129,6 +6129,8 @@ get_last_escaped_event_id(SlonikStmt * stmt,
                                event_id = PQgetvalue(result, 0, 0);
                                if (event_id != NULL)
                                        cur_event_id = strtoll(event_id, NULL, 10);
+                               else
+                                       cur_event_id = -1;
                                if (cur_event_id > max_event_id)
                                        max_event_id = cur_event_id;
                        }
index 0b48ff19494c56de48131f7efff151dbb263d096..be52c0095422c25aa574848b5933a6730626fac9 100644 (file)
@@ -507,6 +507,13 @@ process_archive(char *fname)
 
                destinationfname = dstring_data(&destfname);
        }
+       else
+       {
+               /*
+                * This is to avoid a "possibly used uninitialized" warning.
+                */
+               dstring_data(&destfname) = NULL;
+       }
 
        for (cmd = pre_processing_commands; cmd != NULL; cmd = cmd->next)
        {
@@ -530,6 +537,7 @@ process_archive(char *fname)
                        errlog(LOG_ERROR, "cannot open %s - %s\n",
                                   dstring_data(&destfname), strerror(errno));
                        fclose(fp);
+                       destinationfname = NULL;
                        dstring_free(&destfname);
                        return 1;
                }