commit c25feded5b4a1aaa0beb1b33d9d45594c0bc2b34 from: Omar Polo date: Mon Jul 26 18:12:28 2021 UTC s/SIMPLEQ_/STAILQ_/g STAILQ_* macros seems to be more widespread than SIMPLEQ_* commit - a79f5e909b690e6aff8b27f6a04929198e9178dd commit + c25feded5b4a1aaa0beb1b33d9d45594c0bc2b34 blob - d701ac1b3c51cb59ae0262da152f63ba87f17caa blob + 24e46208501b85221f5311120defe4c6c003ae98 --- configure.ac +++ configure.ac @@ -61,7 +61,7 @@ AC_REPLACE_FUNCS([ strtonum \ ]) -AC_MSG_CHECKING([for sys/queue.h with TAILQ_FOREACH_SAFE and SIMPLEQ_ENTRY]) +AC_MSG_CHECKING([for sys/queue.h with TAILQ_FOREACH_SAFE and STAILQ_ENTRY]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include @@ -75,9 +75,9 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ /* nop */ ; } - SIMPLEQ_HEAD(listhead, q_entry) head = SIMPLEQ_HEAD_INITIALIZER(head); - struct q_entry { - SIMPLEQ_ENTRY(q_entry) entries; + STAILQ_HEAD(listhead, qentry) qhead = STAILQ_HEAD_INITIALIZER(qhead); + struct qentry { + STAILQ_ENTRY(qentry) entries; } foo; return 0; blob - 107da6c0ffb2cb9ef0163fc41e46ae7bb10759bd blob + 5862ebf59d71fd8c3c5f6f299fad2cb75ad55792 --- kamid.c +++ kamid.c @@ -250,7 +250,7 @@ auth_table_by_id(uint32_t id) { struct kd_listen_conf *listen; - SIMPLEQ_FOREACH(listen, &main_conf->listen_head, entry) { + STAILQ_FOREACH(listen, &main_conf->listen_head, entry) { if (listen->id == id) return listen->auth_table; } @@ -428,14 +428,14 @@ main_imsg_send_config(struct kd_conf *xconf) /* Send fixed part of config to children. */ SEND(IMSG_RECONF_CONF, -1, xconf, sizeof(*xconf)); - SIMPLEQ_FOREACH(pki, &xconf->pki_head, entry) { + STAILQ_FOREACH(pki, &xconf->pki_head, entry) { log_debug("sending pki %s", pki->name); SEND(IMSG_RECONF_PKI, -1, pki->name, sizeof(pki->name)); SEND(IMSG_RECONF_PKI_CERT, -1, pki->cert, pki->certlen); SEND(IMSG_RECONF_PKI_KEY, -1, pki->key, pki->keylen); } - SIMPLEQ_FOREACH(listen, &xconf->listen_head, entry) { + STAILQ_FOREACH(listen, &xconf->listen_head, entry) { log_debug("sending listen on port %d", listen->port); SEND(IMSG_RECONF_LISTEN, make_socket_for(listen), listen, sizeof(*listen)); blob - afcfd6be4a456c92c0afedd1b22dcb8cf79f7770 blob + f3879b8a29c0d8518efde405bc6ee9a8b9cfd726 --- kamid.h +++ kamid.h @@ -90,7 +90,7 @@ extern struct table_backend table_static; #define L_NONE 0x0 #define L_TLS 0x1 struct kd_listen_conf { - SIMPLEQ_ENTRY(kd_listen_conf) entry; + STAILQ_ENTRY(kd_listen_conf) entry; uint32_t id; uint32_t flags; int fd; @@ -103,7 +103,7 @@ struct kd_listen_conf { }; struct kd_pki_conf { - SIMPLEQ_ENTRY(kd_pki_conf) entry; + STAILQ_ENTRY(kd_pki_conf) entry; char name[LINE_MAX]; uint8_t *cert; size_t certlen; @@ -113,15 +113,15 @@ struct kd_pki_conf { }; struct kd_tables_conf { - SIMPLEQ_ENTRY(kd_tables_conf) entry; + STAILQ_ENTRY(kd_tables_conf) entry; struct table *table; }; struct kd_conf { struct kd_options_conf kd_options; - SIMPLEQ_HEAD(kd_pki_conf_head, kd_pki_conf) pki_head; - SIMPLEQ_HEAD(kd_tables_conf_head, kd_tables_conf) table_head; - SIMPLEQ_HEAD(kd_listen_conf_head, kd_listen_conf) listen_head; + STAILQ_HEAD(kd_pki_conf_head, kd_pki_conf) pki_head; + STAILQ_HEAD(kd_tables_conf_head, kd_tables_conf) table_head; + STAILQ_HEAD(kd_listen_conf_head, kd_listen_conf) listen_head; }; struct kd_auth_req { blob - 30b424687f108dac8743d1d3a2b862a40453f342 blob + 03980e5c129de41abd78c5b783d6c68efa12afba --- listener.c +++ listener.c @@ -228,7 +228,7 @@ listener_receive_config(struct imsg *imsg, struct kd_c "IMSG_RECONF_PKI", __func__); (*pki)->keylen = IMSG_DATA_SIZE(*imsg); (*pki)->key = xmemdup(imsg->data, (*pki)->keylen); - SIMPLEQ_INSERT_HEAD(&(*nconf)->pki_head, *pki, entry); + STAILQ_INSERT_HEAD(&(*nconf)->pki_head, *pki, entry); pki = NULL; break; case IMSG_RECONF_LISTEN: @@ -246,7 +246,7 @@ listener_receive_config(struct imsg *imsg, struct kd_c __func__); listen->auth_table = NULL; memset(&listen->ev, 0, sizeof(listen->ev)); - SIMPLEQ_INSERT_HEAD(&(*nconf)->listen_head, listen, entry); + STAILQ_INSERT_HEAD(&(*nconf)->listen_head, listen, entry); break; case IMSG_RECONF_END: if (*nconf == NULL) @@ -264,7 +264,7 @@ listen_by_id(uint32_t id) { struct kd_listen_conf *l; - SIMPLEQ_FOREACH(l, &listener_conf->listen_head, entry) { + STAILQ_FOREACH(l, &listener_conf->listen_head, entry) { if (l->id == id) return l; } @@ -505,7 +505,7 @@ pki_by_name(const char *name) { struct kd_pki_conf *pki; - SIMPLEQ_FOREACH(pki, &listener_conf->pki_head, entry) { + STAILQ_FOREACH(pki, &listener_conf->pki_head, entry) { if (!strcmp(name, pki->name)) return pki; } @@ -522,7 +522,7 @@ apply_config(struct kd_conf *conf) listener_conf = conf; /* prepare the various tls_config */ - SIMPLEQ_FOREACH(pki, &listener_conf->pki_head, entry) { + STAILQ_FOREACH(pki, &listener_conf->pki_head, entry) { if ((pki->tlsconf = tls_config_new()) == NULL) fatal("tls_config_new"); tls_config_verify_client_optional(pki->tlsconf); @@ -535,7 +535,7 @@ apply_config(struct kd_conf *conf) } /* prepare and kickoff the listeners */ - SIMPLEQ_FOREACH(listen, &listener_conf->listen_head, entry) { + STAILQ_FOREACH(listen, &listener_conf->listen_head, entry) { if ((listen->ctx = tls_server()) == NULL) fatal("tls_server"); blob - e209e1eef4c978c323777d1cc1e8a9fa355d73cf blob + a1a93b781e833db03ec3a10b50258280c7556089 --- parse.y +++ parse.y @@ -820,7 +820,7 @@ add_table(const char *name, const char *type, const ch { if (table_open(conf, name, type, path) == -1) yyerror("can't initialize table %s", name); - table = SIMPLEQ_FIRST(&conf->table_head)->table; + table = STAILQ_FIRST(&conf->table_head)->table; } static struct table * @@ -828,7 +828,7 @@ findtable(const char *name) { struct kd_tables_conf *i; - SIMPLEQ_FOREACH(i, &conf->table_head, entry) { + STAILQ_FOREACH(i, &conf->table_head, entry) { if (!strcmp(i->table->t_name, name)) return i->table; } @@ -842,7 +842,7 @@ add_cert(const char *name, const char *path) { struct kd_pki_conf *pki; - SIMPLEQ_FOREACH(pki, &conf->pki_head, entry) { + STAILQ_FOREACH(pki, &conf->pki_head, entry) { if (strcmp(name, pki->name) != 0) continue; @@ -856,7 +856,7 @@ add_cert(const char *name, const char *path) pki = xcalloc(1, sizeof(*pki)); strlcpy(pki->name, name, sizeof(pki->name)); - SIMPLEQ_INSERT_HEAD(&conf->pki_head, pki, entry); + STAILQ_INSERT_HEAD(&conf->pki_head, pki, entry); set: if ((pki->cert = tls_load_file(path, &pki->certlen, NULL)) == NULL) @@ -868,7 +868,7 @@ add_key(const char *name, const char *path) { struct kd_pki_conf *pki; - SIMPLEQ_FOREACH(pki, &conf->pki_head, entry) { + STAILQ_FOREACH(pki, &conf->pki_head, entry) { if (strcmp(name, pki->name) != 0) continue; @@ -882,7 +882,7 @@ add_key(const char *name, const char *path) pki = xcalloc(1, sizeof(*pki)); strlcpy(pki->name, name, sizeof(pki->name)); - SIMPLEQ_INSERT_HEAD(&conf->pki_head, pki, entry); + STAILQ_INSERT_HEAD(&conf->pki_head, pki, entry); set: if ((pki->key = tls_load_file(path, &pki->keylen, NULL)) == NULL) @@ -898,6 +898,6 @@ listen_new(void) l->id = counter++; l->fd = -1; - SIMPLEQ_INSERT_HEAD(&conf->listen_head, l, entry); + STAILQ_INSERT_HEAD(&conf->listen_head, l, entry); return l; } blob - 46f79945461551c274bd43dde06e15bdfd42d004 blob + 801209c5402fa8ad9a51028d4aa0e06848279093 --- table.c +++ table.c @@ -62,7 +62,7 @@ found: entry = xcalloc(1, sizeof(*entry)); entry->table = t; - SIMPLEQ_INSERT_HEAD(&conf->table_head, entry, entry); + STAILQ_INSERT_HEAD(&conf->table_head, entry, entry); return 0; }