Introduce our own shutdown callback mechanism.

Instead of adding stuff to `_shutdown()`, we can now register a shutdown
routine from the respective `init()` function of our modules.

This also has the advantage, that we're sure they're called in reverse
order from how the initialization happened.

I didn't simply use `atexit()` because POSIX says that the number of
possible callbacks is limited (min 32) and I was not sure whether
we will maybe extend this number at one point.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
Steffen Jaeckel
2025-03-07 11:44:31 +01:00
parent 662a0be633
commit c5a131ee46
39 changed files with 321 additions and 327 deletions

View File

@@ -183,7 +183,6 @@ jabber_conn_status_t session_connect_with_details(const char* const jid, const c
jabber_conn_status_t session_connect_with_account(const ProfAccount* const account);
void session_disconnect(void);
void session_shutdown(void);
void session_process_events(void);
const char* session_get_account_name(void);
void session_reconnect_now(void);
@@ -275,7 +274,6 @@ void iq_muc_register_nick(const char* const roomjid);
void autoping_timer_extend(void);
EntityCapabilities* caps_lookup(const char* const jid);
void caps_close(void);
void caps_destroy(EntityCapabilities* caps);
void caps_reset_ver(void);
void caps_add_feature(char* feature);