← Commit list

df5c6b6f54

Viktor Szakats
Viktor Szakats
2026-03-09
SUCCESS Duration: 272s

Subject

docs: handle error in `curl_global_init*` examples

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

docs/libcurl/curl_global_init.md+8 -3
@@ -117,11 +117,16 @@ elapses.
~~~c
int main(void)
{
- curl_global_init(CURL_GLOBAL_DEFAULT);
+ CURLcode result;
- /* use libcurl, then before exiting... */
+ result = curl_global_init(CURL_GLOBAL_DEFAULT);
- curl_global_cleanup();
+ if(result == CURLE_OK) {
+
+ /* use libcurl, then before exiting... */
+
+ curl_global_cleanup();
+ }
}
~~~
docs/libcurl/curl_global_init_mem.md+12 -3
@@ -84,9 +84,18 @@ extern void *calloc_cb(size_t, size_t);
int main(void)
{
- curl_global_init_mem(CURL_GLOBAL_DEFAULT, malloc_cb,
- free_cb, realloc_cb,
- strdup_cb, calloc_cb);
+ CURLcode result;
+
+ result = curl_global_init_mem(CURL_GLOBAL_DEFAULT, malloc_cb,
+ free_cb, realloc_cb,
+ strdup_cb, calloc_cb);
+
+ if(result == CURLE_OK) {
+
+ /* use libcurl, then before exiting... */
+
+ curl_global_cleanup();
+ }
}
~~~