Refactor to fix some OS-X compile warnings

Fixes two minor bugs that escaped notice until now
This commit is contained in:
Andrew Bettison 2014-08-14 17:39:44 +09:30
parent ccece93309
commit 7e1fbe8c76
5 changed files with 18 additions and 13 deletions

View File

@ -875,7 +875,6 @@ static int cf_opt_network_interface_legacy(struct config_network_interface *nifp
{
//DEBUGF("%s text=%s", __FUNCTION__, alloca_str_toprint(text));
struct config_network_interface nif;
(&nif);
cf_dfl_config_network_interface(&nif);
if (text[0] != '+' && text[0] != '-')
return CFINVALID; // "Sign must be + or -"

View File

@ -217,6 +217,6 @@ int golay_decode(int *errs, const uint8_t *data)
cw=correct(cw, errs); /* correct up to three bits */
cw|=parity_bit;
if (parity(cw))
*errs++;
++*errs;
return cw&0xFFF;
} /* decode */

View File

@ -71,9 +71,11 @@ struct profile_total mdp_sock_stats={
};
struct sched_ent mdp_sock={
.poll.revents = 0,
.poll.events = POLLIN,
.poll.fd = -1,
.poll = {
.revents = 0,
.events = POLLIN,
.fd = -1
},
.function = msp_poll,
.stats = &mdp_sock_stats,
};
@ -83,9 +85,11 @@ struct profile_total service_sock_stats={
};
struct sched_ent service_sock={
.poll.revents = 0,
.poll.events = POLLIN,
.poll.fd = -1,
.poll = {
.revents = 0,
.events = POLLIN,
.fd = -1
},
.function = service_poll,
.stats = &service_sock_stats,
};
@ -99,9 +103,11 @@ struct profile_total listen_stats={
};
struct sched_ent listen_alarm={
.poll.revents = 0,
.poll.events = POLLIN,
.poll.fd = -1,
.poll = {
.revents = 0,
.events = POLLIN,
.fd = -1
},
.function = listen_poll,
.stats = &listen_stats,
};

2
os.c
View File

@ -361,7 +361,7 @@ ssize_t get_self_executable_path(char *buf, size_t len)
return read_symlink("/proc/self/path/a.out", buf, len);
#elif defined (__APPLE__)
uint32_t bufsize = len;
return _NSGetExecutablePath(buf, &bufsize) == -1 && len ? -1 : bufsize;
return _NSGetExecutablePath(buf, &bufsize) || len == 0 ? bufsize : -1;
#else
#error Unable to find executable path
#endif

View File

@ -1073,7 +1073,7 @@ int _sqlite_vexec_strbuf_retry(struct __sourceloc __whence, sqlite_retry_state *
while ((stepcode = _sqlite_step(__whence, LOG_LEVEL_ERROR, retry, statement)) == SQLITE_ROW) {
int columncount = sqlite3_column_count(statement);
if (columncount != 1)
ret - WHYF("incorrect column count %d (should be 1): %s", columncount, sqlite3_sql(statement));
ret = WHYF("incorrect column count %d (should be 1): %s", columncount, sqlite3_sql(statement));
else if (++rowcount == 1)
strbuf_puts(sb, (const char *)sqlite3_column_text(statement, 0));
}