From df7dc1a8ba5836b373ae3c51cd8464c43ab09f07 Mon Sep 17 00:00:00 2001 From: Peter Ohler Date: Sun, 28 Jul 2024 18:04:26 -0400 Subject: [PATCH 1/4] WIP --- ext/agoo/agoo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/agoo/agoo.c b/ext/agoo/agoo.c index 5c5c745..9b3f973 100644 --- a/ext/agoo/agoo.c +++ b/ext/agoo/agoo.c @@ -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(); @@ -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); From f054014c4fac9bc6bdce42f8fed901a1e006dd67 Mon Sep 17 00:00:00 2001 From: Peter Ohler Date: Sun, 28 Jul 2024 18:05:47 -0400 Subject: [PATCH 2/4] old-style --- ext/agoo/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/agoo/debug.c b/ext/agoo/debug.c index fbc1a1d..e3cd5dd 100644 --- a/ext/agoo/debug.c +++ b/ext/agoo/debug.c @@ -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); @@ -320,7 +320,7 @@ print_stats() { #endif void -debug_report() { +debug_report(void) { #ifdef MEM_DEBUG print_stats(); #endif From c7df70ae1328351bbf621b5d5b9515d8b0bc1ab0 Mon Sep 17 00:00:00 2001 From: Peter Ohler Date: Sun, 28 Jul 2024 18:12:17 -0400 Subject: [PATCH 3/4] WIP --- ext/agoo/domain.c | 4 ++-- ext/agoo/dtime.c | 2 +- ext/agoo/error_stream.c | 2 +- ext/agoo/gqleval.c | 2 +- ext/agoo/graphql.c | 2 +- ext/agoo/http.c | 4 ++-- ext/agoo/log.c | 18 +++++++++--------- ext/agoo/page.c | 2 +- ext/agoo/rack_logger.c | 2 +- ext/agoo/rresponse.c | 2 +- ext/agoo/rserver.c | 2 +- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ext/agoo/domain.c b/ext/agoo/domain.c index cfc75e7..f4b7450 100644 --- a/ext/agoo/domain.c +++ b/ext/agoo/domain.c @@ -19,7 +19,7 @@ typedef struct _domain { static Domain domains = NULL; bool -agoo_domain_use() { +agoo_domain_use(void) { return NULL != domains; } @@ -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)) { diff --git a/ext/agoo/dtime.c b/ext/agoo/dtime.c index 48d1c7e..6657bd9 100644 --- a/ext/agoo/dtime.c +++ b/ext/agoo/dtime.c @@ -12,7 +12,7 @@ #endif double -dtime() { +dtime(void) { struct timespec ts; clock_gettime(CLOCK_REALTIME_COURSE, &ts); diff --git a/ext/agoo/error_stream.c b/ext/agoo/error_stream.c index 0601c31..551ca73 100644 --- a/ext/agoo/error_stream.c +++ b/ext/agoo/error_stream.c @@ -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) { diff --git a/ext/agoo/gqleval.c b/ext/agoo/gqleval.c index 225bc61..12dbf59 100644 --- a/ext/agoo/gqleval.c +++ b/ext/agoo/gqleval.c @@ -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); } diff --git a/ext/agoo/graphql.c b/ext/agoo/graphql.c index 79ccdcb..f6f975c 100644 --- a/ext/agoo/graphql.c +++ b/ext/agoo/graphql.c @@ -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; diff --git a/ext/agoo/http.c b/ext/agoo/http.c index a551740..2973a2f 100644 --- a/ext/agoo/http.c +++ b/ext/agoo/http.c @@ -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)); @@ -475,7 +475,7 @@ agoo_http_init() { } void -agoo_http_cleanup() { +agoo_http_cleanup(void) { Slot *sp = key_cache.buckets; Slot s; Slot n; diff --git a/ext/agoo/log.c b/ext/agoo/log.c index f6c466f..10301c0 100644 --- a/ext/agoo/log.c +++ b/ext/agoo/log.c @@ -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; @@ -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]; @@ -105,7 +105,7 @@ agoo_log_listen() { } static void -agoo_log_release() { +agoo_log_release(void) { char buf[8]; // clear pipe @@ -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; @@ -271,7 +271,7 @@ remove_old_logs() { } void -agoo_log_rotate() { +agoo_log_rotate(void) { char from[1060]; char to[1060]; int seq; @@ -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) { @@ -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); @@ -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); @@ -459,7 +459,7 @@ agoo_now_nano() { } #else int64_t -agoo_now_nano() { +agoo_now_nano(void) { struct timeval tv; struct timezone tz; diff --git a/ext/agoo/page.c b/ext/agoo/page.c index 61db2da..c9d32b8 100644 --- a/ext/agoo/page.c +++ b/ext/agoo/page.c @@ -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; diff --git a/ext/agoo/rack_logger.c b/ext/agoo/rack_logger.c index eb14ed3..770d1cc 100644 --- a/ext/agoo/rack_logger.c +++ b/ext/agoo/rack_logger.c @@ -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); } diff --git a/ext/agoo/rresponse.c b/ext/agoo/rresponse.c index 01722b7..bb305bc 100644 --- a/ext/agoo/rresponse.c +++ b/ext/agoo/rresponse.c @@ -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) { diff --git a/ext/agoo/rserver.c b/ext/agoo/rserver.c index 396969c..cac3372 100644 --- a/ext/agoo/rserver.c +++ b/ext/agoo/rserver.c @@ -918,7 +918,7 @@ rserver_start(VALUE self) { } 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 From e61cc550e356cd40a9b7613c32610b0874484ed9 Mon Sep 17 00:00:00 2001 From: Peter Ohler Date: Sun, 28 Jul 2024 18:15:40 -0400 Subject: [PATCH 4/4] WIP --- ext/agoo/rserver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/agoo/rserver.c b/ext/agoo/rserver.c index cac3372..29df157 100644 --- a/ext/agoo/rserver.c +++ b/ext/agoo/rserver.c @@ -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; } @@ -912,7 +912,7 @@ rserver_start(VALUE self) { dsleep(0.05); } } - rb_set_end_proc(on_exit, Qnil); + rb_set_end_proc(stop_server, Qnil); return Qnil; }