Skip to content

Commit

Permalink
Fix compiler warnings from gcc 3.4.3 on Solaris.
Browse files Browse the repository at this point in the history
  • Loading branch information
kr committed May 15, 2009
1 parent 99d1191 commit 9c61ad0
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
4 changes: 3 additions & 1 deletion beanstalkd.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
static char *user = NULL;
static int detach = 0;
static int port = 11300;
static struct in_addr host_addr = { INADDR_ANY };
static struct in_addr host_addr;

static void
nullfd(int fd, int flags)
Expand Down Expand Up @@ -261,6 +261,8 @@ main(int argc, char **argv)
struct event_base *ev_base;
struct job binlog_jobs = {};

host_addr.s_addr = INADDR_ANY;

progname = argv[0];
opts(argc, argv);

Expand Down
4 changes: 2 additions & 2 deletions binlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ make_binlog(char *path)
binlog b;

b = (binlog) malloc(sizeof(struct binlog) + strlen(path) + 1);
if (!b) return twarnx("OOM"), NULL;
if (!b) return twarnx("OOM"), (binlog) 0;
strcpy(b->path, path);
b->refs = 0;
b->next = NULL;
Expand All @@ -260,7 +260,7 @@ make_next_binlog()
if (!binlog_dir) return NULL;

r = snprintf(path, PATH_MAX, "%s/binlog.%d", binlog_dir, ++binlog_index);
if (r > PATH_MAX) return twarnx("path too long: %s", binlog_dir), NULL;
if (r > PATH_MAX) return twarnx("path too long: %s", binlog_dir), (binlog)0;

return make_binlog(path);
}
Expand Down
4 changes: 2 additions & 2 deletions conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ make_conn(int fd, char start_state, tube use, tube watch)
conn c;

c = conn_alloc();
if (!c) return twarn("OOM"), NULL;
if (!c) return twarn("OOM"), (conn) 0;

ms_init(&c->watch, (ms_event_fn) on_watch, (ms_event_fn) on_ignore);
if (!ms_append(&c->watch, watch)) {
conn_free(c);
return twarn("OOM"), NULL;
return twarn("OOM"), (conn) 0;
}

c->use = NULL; /* initialize */
Expand Down
6 changes: 3 additions & 3 deletions job.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ allocate_job(int body_size)
job j;

j = malloc(sizeof(struct job) + body_size);
if (!j) return twarnx("OOM"), NULL;
if (!j) return twarnx("OOM"), (job) 0;

j->id = 0;
j->state = JOB_STATE_INVALID;
Expand All @@ -130,7 +130,7 @@ make_job_with_id(unsigned int pri, unsigned int delay, unsigned int ttr,
job j;

j = allocate_job(body_size);
if (!j) return twarnx("OOM"), NULL;
if (!j) return twarnx("OOM"), (job) 0;

if (id) {
j->id = id;
Expand Down Expand Up @@ -203,7 +203,7 @@ job_copy(job j)
if (!j) return NULL;

n = malloc(sizeof(struct job) + j->body_size);
if (!n) return twarnx("OOM"), NULL;
if (!n) return twarnx("OOM"), (job) 0;

memcpy(n, j, sizeof(struct job) + j->body_size);
n->next = n->prev = n; /* not in a linked list */
Expand Down
4 changes: 2 additions & 2 deletions prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ size_t job_data_size_limit = JOB_DATA_SIZE_LIMIT_DEFAULT;
"current-workers: %u\n" \
"current-waiting: %u\n" \
"total-connections: %u\n" \
"pid: %u\n" \
"pid: %ld\n" \
"version: %s\n" \
"rusage-utime: %d.%06d\n" \
"rusage-stime: %d.%06d\n" \
Expand Down Expand Up @@ -839,7 +839,7 @@ fmt_stats(char *buf, size_t size, void *x)
count_cur_workers(),
global_stat.waiting_ct,
count_tot_conns(),
getpid(),
(long) getpid(),
VERSION,
(int) ru.ru_utime.tv_sec, (int) ru.ru_utime.tv_usec,
(int) ru.ru_stime.tv_sec, (int) ru.ru_stime.tv_usec,
Expand Down
2 changes: 1 addition & 1 deletion tube.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ make_and_insert_tube(const char *name)
/* We want this global tube list to behave like "weak" refs, so don't
* increment the ref count. */
r = ms_append(&tubes, t);
if (!r) return tube_dref(t), NULL;
if (!r) return tube_dref(t), (tube) 0;

return t;
}
Expand Down

0 comments on commit 9c61ad0

Please sign in to comment.