int sol_comms_init(void) { int ret; ret = sol_network_init(); if (ret != 0) return -1; ret = sol_http_client_init(); if (ret != 0) goto http_client_error; ret = sol_http_server_init(); if (ret != 0) goto http_server_error; return 0; http_server_error: sol_http_client_init(); http_client_error: sol_network_shutdown(); return -1; }
int sol_comms_init(void) { int ret; ret = sol_network_init(); if (ret != 0) return -1; #ifdef HTTP_CLIENT ret = sol_http_client_init(); if (ret != 0) goto http_error; #endif return 0; #ifdef HTTP_CLIENT http_error: sol_network_shutdown(); #endif return -1; }