Skip to content

Commit

Permalink
Fix latest compiler errors (#134)
Browse files Browse the repository at this point in the history
Fix gcc errors.
  • Loading branch information
ohler55 authored Jul 28, 2024
1 parent 6bf95fd commit 6313376
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions ext/agoo/agoo.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ sig_atomic_t agoo_stop = 0;
static atomic_int shutdown_started = AGOO_ATOMIC_INT_INIT(0);

void
agoo_shutdown() {
agoo_shutdown(void) {
if (0 == atomic_fetch_add(&shutdown_started, 1)) {
rserver_shutdown(Qnil);
agoo_log_close();
Expand Down Expand Up @@ -99,7 +99,7 @@ sig_handler(int sig) {
* agoo is a Japanese word for a type of flying fish.
*/
void
Init_agoo() {
Init_agoo(void) {
VALUE mod = rb_define_module("Agoo");

rlog_init(mod);
Expand Down
4 changes: 2 additions & 2 deletions ext/agoo/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ update_reps(Rep reps, Rec r) {
}

static void
print_stats() {
print_stats(void) {
printf("\n--- Memory Usage Report --------------------------------------------------------\n");
pthread_mutex_lock(&lock);

Expand Down Expand Up @@ -320,7 +320,7 @@ print_stats() {
#endif

void
debug_report() {
debug_report(void) {
#ifdef MEM_DEBUG
print_stats();
#endif
Expand Down
4 changes: 2 additions & 2 deletions ext/agoo/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef struct _domain {
static Domain domains = NULL;

bool
agoo_domain_use() {
agoo_domain_use(void) {
return NULL != domains;
}

Expand Down Expand Up @@ -128,7 +128,7 @@ agoo_domain_resolve(const char *host, char *buf, size_t blen) {
}

void
agoo_domain_cleanup() {
agoo_domain_cleanup(void) {
Domain d;

while (NULL != (d = domains)) {
Expand Down
2 changes: 1 addition & 1 deletion ext/agoo/dtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#endif

double
dtime() {
dtime(void) {
struct timespec ts;

clock_gettime(CLOCK_REALTIME_COURSE, &ts);
Expand Down
2 changes: 1 addition & 1 deletion ext/agoo/error_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ es_free(void *ptr) {
}

VALUE
error_stream_new() {
error_stream_new(void) {
ErrorStream es = (ErrorStream)AGOO_MALLOC(sizeof(struct _errorStream));

if (NULL == es) {
Expand Down
2 changes: 1 addition & 1 deletion ext/agoo/gqleval.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ gql_eval_sels(agooErr err, gqlDoc doc, gqlRef ref, gqlField field, gqlSel sels,
}

gqlType
gql_root_type() {
gql_root_type(void) {
if (NULL == _gql_root_type && NULL != gql_type_func) {
_gql_root_type = gql_type_func(gql_root);
}
Expand Down
2 changes: 1 addition & 1 deletion ext/agoo/graphql.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ gql_init(agooErr err) {

extern gqlType _gql_root_type;
void
gql_destroy() {
gql_destroy(void) {
Slot *sp = buckets;
Slot s;
Slot n;
Expand Down
4 changes: 2 additions & 2 deletions ext/agoo/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ key_set(const char *key) {
}

void
agoo_http_init() {
agoo_http_init(void) {
const char **kp = header_keys;

memset(&key_cache, 0, sizeof(struct _cache));
Expand All @@ -475,7 +475,7 @@ agoo_http_init() {
}

void
agoo_http_cleanup() {
agoo_http_cleanup(void) {
Slot *sp = key_cache.buckets;
Slot s;
Slot n;
Expand Down
18 changes: 9 additions & 9 deletions ext/agoo/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ find_color(const char *name) {
}

static bool
agoo_log_queue_empty() {
agoo_log_queue_empty(void) {
agooLogEntry head = atomic_load(&agoo_log.head);
agooLogEntry next = head + 1;

Expand All @@ -88,7 +88,7 @@ agoo_log_queue_empty() {
}

static int
agoo_log_listen() {
agoo_log_listen(void) {
if (0 == agoo_log.rsock) {
int fd[2];

Expand All @@ -105,7 +105,7 @@ agoo_log_listen() {
}

static void
agoo_log_release() {
agoo_log_release(void) {
char buf[8];

// clear pipe
Expand Down Expand Up @@ -233,7 +233,7 @@ classic_write(agooLogEntry e, FILE *file) {
// Remove all file with sequence numbers higher than max_files. max_files is
// max number of archived version. It does not include the primary.
static void
remove_old_logs() {
remove_old_logs(void) {
struct dirent *de;
long seq;
char *end;
Expand Down Expand Up @@ -271,7 +271,7 @@ remove_old_logs() {
}

void
agoo_log_rotate() {
agoo_log_rotate(void) {
char from[1060];
char to[1060];
int seq;
Expand Down Expand Up @@ -356,7 +356,7 @@ agoo_log_flush(double timeout) {
}

void
agoo_log_open_file() {
agoo_log_open_file(void) {
char path[1500];

if (agoo_log.with_pid) {
Expand All @@ -379,7 +379,7 @@ agoo_log_open_file() {
}

void
agoo_log_close() {
agoo_log_close(void) {
agoo_log.done = true;
// TBD wake up loop like push does
agoo_log_cat_on(NULL, false);
Expand Down Expand Up @@ -450,7 +450,7 @@ agoo_log_cat_find(const char *label) {

#ifdef CLOCK_REALTIME
int64_t
agoo_now_nano() {
agoo_now_nano(void) {
struct timespec ts;

clock_gettime(CLOCK_REALTIME, &ts);
Expand All @@ -459,7 +459,7 @@ agoo_now_nano() {
}
#else
int64_t
agoo_now_nano() {
agoo_now_nano(void) {
struct timeval tv;
struct timezone tz;

Expand Down
2 changes: 1 addition & 1 deletion ext/agoo/page.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ agoo_page_destroy(agooPage p) {
}

void
agoo_pages_cleanup() {
agoo_pages_cleanup(void) {
Slot *sp = cache.buckets;
Slot s;
Slot n;
Expand Down
2 changes: 1 addition & 1 deletion ext/agoo/rack_logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
static VALUE rl_class = Qundef;

VALUE
rack_logger_new() {
rack_logger_new(void) {
return rb_class_new_instance(0, NULL, rl_class);
}

Expand Down
2 changes: 1 addition & 1 deletion ext/agoo/rresponse.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ response_free(void *ptr) {
}

VALUE
response_new() {
response_new(void) {
agooResponse res = (agooResponse)AGOO_MALLOC(sizeof(struct _agooResponse));

if (NULL == res) {
Expand Down
6 changes: 3 additions & 3 deletions ext/agoo/rserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ wrap_process_loop(void *ptr) {
return Qnil;
}

static void on_exit(VALUE x) {
static void stop_server(VALUE x) {
agoo_server.active = false;
}

Expand Down Expand Up @@ -912,13 +912,13 @@ rserver_start(VALUE self) {
dsleep(0.05);
}
}
rb_set_end_proc(on_exit, Qnil);
rb_set_end_proc(stop_server, Qnil);

return Qnil;
}

static void
stop_runners() {
stop_runners(void) {
// The preferred method of waiting for the ruby threads would be either a
// join or even a kill but since we may not have the gvl here that would
// cause a segfault. Instead we set a timeout and wait for the running
Expand Down

0 comments on commit 6313376

Please sign in to comment.