Lazy so curl costs nothing until a script actually transfers. Single script thread + one run at a time, so no init race.
| 38 | // Lazy so curl costs nothing until a script actually transfers. Single |
| 39 | // script thread + one run at a time, so no init race. |
| 40 | bool curlReady(void) |
| 41 | { |
| 42 | static bool ready = false; |
| 43 | if (!ready) { |
| 44 | ready = curl_global_init(CURL_GLOBAL_DEFAULT) == CURLE_OK; |
| 45 | } |
| 46 | return ready; |
| 47 | } |
| 48 | |
| 49 | // Allocation-safe on purpose. The prebuilt curl portlib carries no unwind |
| 50 | // info, so a std::bad_alloc out of append() — the realistic case on an O3DS |