Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Riley Berton committed Apr 20, 2016
1 parent 6aee144 commit 97313f9
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 37 deletions.
2 changes: 1 addition & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ POSTGRES_INGESTOR_MODULE="no"
AC_TRY_LINK([
#include <libpq-fe.h>
],
[ PGconn *dbh = PQconnectdb(""); ],
[ PGconn *dbh = PQconnectdb(""); (void)dbh; ],
[
BUILD_MODULES="$BUILD_MODULES postgres.$MODULEEXT"
BUILD_SMODULES="$BUILD_SMODULES postgres_ingestor.$MODULEEXT"
Expand Down
2 changes: 0 additions & 2 deletions src/modules/custom_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ static int custom_config_module_id = -1;

static int
custom_config_onload(mtev_image_t *self) {
int i, cnt;
mtev_conf_section_t *acl_c;
custom_config_module_id = noit_check_register_module("custom");
if(custom_config_module_id < 0) return -1;
return 0;
Expand Down
3 changes: 2 additions & 1 deletion src/modules/fq_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ struct fq_driver {
time_t last_error[MAX_HOSTS];
};

struct fq_driver global_fq_ctx = { 0 };
static struct fq_driver global_fq_ctx;

#define BUMPSTAT(i,a) mtev_atomic_inc64(&global_fq_ctx.stats[i].a)

Expand Down Expand Up @@ -492,6 +492,7 @@ static int noit_fq_driver_config(mtev_dso_generic_t *self, mtev_hash_table *o) {
return 0;
}
static int noit_fq_driver_onload(mtev_image_t *self) {
memset(&global_fq_ctx, 0, sizeof(struct fq_driver));
return 0;
}

Expand Down
7 changes: 3 additions & 4 deletions src/modules/histogram.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <inttypes.h>
#include <mtev_defines.h>

#include <assert.h>
Expand Down Expand Up @@ -119,7 +120,7 @@ debug_print_hist(histogram_t *ht) {
u_int64_t cnt;
double v;
hist_bucket_idx(ht, i, &v, &cnt);
mtevL(noit_debug, " %7.2g : %llu\n", v, cnt);
mtevL(noit_debug, " %7.2g : %" PRIu64 "\n", v, cnt);
}
}
}
Expand Down Expand Up @@ -446,17 +447,15 @@ histogram_sweep_calculations(struct histogram_config *conf, noit_check_t *check)
int klen;
void *data;
mtev_hash_table *metrics;
stats_t *c;
double *out_q;

c = noit_check_get_stats_current(check);
noit_check_get_stats_current(check);
/* Only need to do work if it's asked for */
if(!conf->mean && !conf->sum && conf->n_quantiles < 1) return;
metrics = noit_check_get_module_metadata(check, histogram_module_id);
if(!metrics) return;
out_q = alloca(sizeof(double *) * conf->n_quantiles);

u_int64_t s = time(NULL);
while(mtev_hash_next(metrics, &iter, &metric_name, &klen, &data)) {
char mname[1024];
histotier *ht = data;
Expand Down
4 changes: 1 addition & 3 deletions src/modules/httptrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,11 @@ static int httptrap_submit(noit_module_t *self, noit_check_t *check,
static int
push_payload_at_check(struct rest_json_payload *rxc) {
httptrap_closure_t *ccl;
mtev_boolean immediate;
char key[256];

if (!rxc->check || strcmp(rxc->check->module, "httptrap")) return 0;
if (rxc->check->closure == NULL) return 0;
ccl = rxc->check->closure;
immediate = noit_httptrap_check_asynch(ccl->self,rxc->check);
noit_httptrap_check_asynch(ccl->self,rxc->check);

/* do it here */
ccl->stats_count = rxc->cnt;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/ip_acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ip_acl_onload(mtev_image_t *self) {
if(rule_c) {
btrie *acl = calloc(1, sizeof(*acl));
for(j=0; j<rcnt; j++) {
int mask = -1, rv;
int mask = -1;
char dirstr[16] = "unspecified";
char *cp, target[256] = "";
union {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/librabbitmq/amqp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static int wait_frame_inner(amqp_connection_state_t state,
state->sock_inbound_buffer.bytes,
state->sock_inbound_buffer.len);
if (result < 0) {
mtevL(mtev_error, "Failed to read message in wait_frame_inner, size %d\n", state->sock_inbound_buffer.len);
mtevL(mtev_error, "Failed to read message in wait_frame_inner, size %zu\n", state->sock_inbound_buffer.len);
return -errno;
}
if (result == 0) {
Expand Down
9 changes: 4 additions & 5 deletions src/modules/lua_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,6 @@ noit_lua_get_state(lua_State *L) {
static int
noit_lua_get_flags(lua_State *L) {
noit_check_t *check;
mtev_lua_resume_info_t *ri;
noit_lua_resume_check_info_t *ci;
u_int32_t andset = ~0;
int narg;

Expand Down Expand Up @@ -698,11 +696,9 @@ noit_lua_module_config(noit_module_t *mod,

static int
noit_lua_module_init(noit_module_t *mod) {
struct module_conf *mc;
struct module_tls_conf *mtlsc;
LMC_DECL(L, mod, object);

mc = noit_module_get_userdata(mod);
mtlsc = __get_module_tls_conf(&mod->hdr);
if(mtlsc->initialized) return mtlsc->initialized_return;

Expand All @@ -717,6 +713,7 @@ noit_lua_module_init(noit_module_t *mod) {
mtlsc->initialized_return = -1;
return -1;
}

static void
noit_lua_module_cleanup(noit_module_t *mod, noit_check_t *check) {
mtev_lua_resume_info_t *ri = check->closure;
Expand Down Expand Up @@ -882,6 +879,9 @@ static int
noit_lua_initiate(noit_module_t *self, noit_check_t *check,
noit_check_t *cause) {
LMC_DECL(L, self, object);
/* deal with unused warning */
(void)L;

struct nl_intcl *int_cl;
mtev_lua_resume_info_t *ri;
noit_lua_resume_check_info_t *ci;
Expand Down Expand Up @@ -966,7 +966,6 @@ static mtev_image_t *
noit_lua_loader_load(mtev_dso_loader_t *loader,
char *module_name,
mtev_conf_section_t section) {
int rv;
noit_module_t *m;
lua_State *L = NULL;
lua_module_closure_t *lmc;
Expand Down
3 changes: 2 additions & 1 deletion src/modules/noit_lua_noit_binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ nl_check(lua_State *L) {
noit_check_t *check;
uuid_t id;
const char *id_str = lua_tostring(L,1);

if(id_str && uuid_parse((char *)id_str, id) == 0) {
noit_check_t *check = noit_poller_lookup(id);
check = noit_poller_lookup(id);
if(check) {
noit_lua_setup_check(L, check);
return 1;
Expand Down
4 changes: 2 additions & 2 deletions src/modules/rabbitmq_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ static int noit_rabbimq_connect(iep_thread_driver_t *dr) {
return -1;
}
if(setsockopt(driver->sockfd, SOL_SOCKET, SO_SNDBUF, &desired_sndbuf, sizeof(desired_sndbuf)) < 0)
mtevL(mtev_debug, "rabbitmq: setsockopt(SO_SNDBUF, %ld) -> %s\n", desired_sndbuf, strerror(errno));
mtevL(mtev_debug, "rabbitmq: setsockopt(SO_SNDBUF, %ld) -> %s\n", (long int)desired_sndbuf, strerror(errno));
if(setsockopt(driver->sockfd, SOL_SOCKET, SO_RCVBUF, &desired_rcvbuf, sizeof(desired_rcvbuf)) < 0)
mtevL(mtev_debug, "rabbitmq: setsockopt(SO_RCVBUF, %ld) -> %s\n", desired_rcvbuf, strerror(errno));
mtevL(mtev_debug, "rabbitmq: setsockopt(SO_RCVBUF, %ld) -> %s\n", (long int)desired_rcvbuf, strerror(errno));
driver->has_error = 0;
driver->connection = amqp_new_connection();
amqp_set_basic_return_cb(driver->connection, noit_rabbitmq_brcb, driver);
Expand Down
4 changes: 1 addition & 3 deletions src/modules/reverse_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ static int reverse_check_module_id = -1;

static int
reverse_check_onload(mtev_image_t *self) {
int i, cnt;
mtev_conf_section_t *acl_c;
reverse_check_module_id = noit_check_register_module("reverse");
if(reverse_check_module_id < 0) return -1;
return 0;
Expand All @@ -75,7 +73,7 @@ reverse_check_allow(const char *id, acceptor_closure_t *ac) {
noit_check_t *check;
const char *key;
uuid_t uuid;
char key_in[128], uuid_str[UUID_STR_LEN+1];
char uuid_str[UUID_STR_LEN+1];
char expected_id[256];

if(strncmp(id, "check/", 6)) return MTEV_ACL_ABSTAIN;
Expand Down
13 changes: 3 additions & 10 deletions src/modules/snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,11 @@ static void _set_ts_timeout(struct target_session *ts, struct timeval *t) {

static int noit_snmp_handler(eventer_t e, int mask, void *closure,
struct timeval *now) {
int block = 0, rv, liberr, snmperr;
int block = 0;
struct timeval timeout = { 0, 0 };
struct target_session *ts = closure;
char *errmsg;

rv = snmp_sess_read_C1(ts->slp, e->fd);
snmp_sess_read_C1(ts->slp, e->fd);
if(noit_snmp_session_cleanse(ts, 0))
return 0;
snmp_sess_select_info2_flags(ts->slp, NULL, NULL,
Expand Down Expand Up @@ -1145,7 +1144,6 @@ ensure_usm_user(const char *username, u_char *engineID, size_t engineIDLen) {
/* Shenanigans to work around snmp v3 probes blocking */
static int
snmpv3_build_probe_pdu(netsnmp_pdu **pdu) {
struct usmUser *user;

/*
* create the pdu
Expand All @@ -1172,7 +1170,6 @@ static int
noit_snmpv3_probe_timeout(eventer_t e, int mask, void *closure,
struct timeval *now) {
struct v3_probe_magic *magic = closure;
struct check_info *info = magic->check->closure;
struct target_session *ts = magic->ts;
if(ts && ts->slp) {
ts->sess_handle->flags &= ~SNMP_FLAGS_DONT_PROBE;
Expand Down Expand Up @@ -1270,7 +1267,7 @@ static int noit_snmp_send(noit_module_t *self, noit_check_t *check,
struct snmp_pdu *req = NULL;
struct target_session *ts;
struct check_info *info = check->closure;
int port = 161, i;
int port = 161;
mtev_boolean separate_queries = mtev_false;
const char *portstr, *versstr, *sepstr;
const char *err = "unknown err";
Expand Down Expand Up @@ -1305,8 +1302,6 @@ static int noit_snmp_send(noit_module_t *self, noit_check_t *check,
gettimeofday(&check->last_fire_time, NULL);
if(!ts->refcnt) {
eventer_t newe;
struct timeval timeout;
netsnmp_session *rsess;
noit_snmp_sess_open(ts, check);
newe = eventer_alloc();
newe->fd = ts->fd;
Expand Down Expand Up @@ -1546,9 +1541,7 @@ static __thread char linebuf[1024] = "\0";
static int
_private_snmp_log(int majorID, int minorID, void *serverarg, void *clientarg) {
struct snmp_log_message *slm;
snmp_mod_config_t *conf;
size_t len;
conf = clientarg;
slm = serverarg;
len = strlcat(linebuf, slm->msg, sizeof(linebuf));
if(len > sizeof(linebuf)-1) {
Expand Down
1 change: 0 additions & 1 deletion src/modules/statsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ statsd_handler(eventer_t e, int mask, void *closure,
} addr;
socklen_t addrlen = sizeof(addr);
ssize_t len;
uuid_t check_id;
len = recvfrom(e->fd, conf->payload, conf->payload_len-1, 0,
(struct sockaddr *)&addr, &addrlen);
if(len < 0) {
Expand Down
5 changes: 3 additions & 2 deletions src/noit_conf_checks.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <inttypes.h>

#include <mtev_conf.h>
#include <mtev_conf_private.h>
Expand Down Expand Up @@ -114,7 +115,7 @@ noit_conf_check_bump_seq(xmlNodePtr node) {
char new_seq_str[64];
/* negatve -> 0, positive ++ */
seq = (seq < 0) ? 0 : (seq + 1);
snprintf(new_seq_str, sizeof(new_seq_str), "%lld", seq);
snprintf(new_seq_str, sizeof(new_seq_str), "%" PRIi64, seq);
xmlUnsetProp(node, (xmlChar *)"seq");
xmlSetProp(node, (xmlChar *)"seq", (xmlChar *)new_seq_str);
}
Expand Down Expand Up @@ -598,7 +599,7 @@ noit_console_show_check(mtev_console_closure_t ncct,
noit_check_available_string(noit_check_stats_available(c, NULL)),
noit_check_state_string(noit_check_stats_state(c, NULL)));
status = noit_check_stats_status(c, NULL);
nc_printf(ncct, " status: %s\n", noit_check_stats_status(c, NULL));
nc_printf(ncct, " status: %s\n", status);
nc_printf(ncct, " feeds: %d\n", check->feeds ? check->feeds->size : 0);
}

Expand Down

0 comments on commit 97313f9

Please sign in to comment.