1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 15:53:12 +02:00

core: call curl init and cleanup functions

This is to prevent issues when these functions are not thread-safe.
This commit is contained in:
Sébastien Helleu
2023-10-13 23:03:00 +02:00
parent 13a057f0b2
commit 9aefe4ae09
3 changed files with 25 additions and 0 deletions
+20
View File
@@ -1573,3 +1573,23 @@ weeurl_option_add_to_infolist (struct t_infolist *infolist,
return 1;
}
/*
* Initializes URL.
*/
void
weeurl_init ()
{
curl_global_init (CURL_GLOBAL_ALL);
}
/*
* Ends URL.
*/
void
weeurl_end ()
{
curl_global_cleanup ();
}
+2
View File
@@ -62,5 +62,7 @@ extern int weeurl_download (const char *url, struct t_hashtable *options,
struct t_hashtable *output);
extern int weeurl_option_add_to_infolist (struct t_infolist *infolist,
struct t_url_option *option);
extern void weeurl_init ();
extern void weeurl_end ();
#endif /* WEECHAT_URL_H */
+3
View File
@@ -74,6 +74,7 @@
#include "wee-signal.h"
#include "wee-string.h"
#include "wee-upgrade.h"
#include "wee-url.h"
#include "wee-utf8.h"
#include "wee-util.h"
#include "wee-version.h"
@@ -640,6 +641,7 @@ weechat_init (int argc, char *argv[], void (*gui_init_cb)())
* weechat_current_start_timeval.tv_usec)
^ getpid ());
weeurl_init (); /* initialize URL */
signal_init (); /* initialize signals */
hdata_init (); /* initialize hdata */
hook_init (); /* initialize hooks */
@@ -720,5 +722,6 @@ weechat_end (void (*gui_end_cb)(int clean_exit))
hdata_end (); /* end hdata */
secure_end (); /* end secured data */
string_end (); /* end string */
weeurl_end ();
weechat_shutdown (-1, 0); /* end other things */
}