CURLcode easysrc_cleanup(void) { CHKRET(easysrc_add(&easysrc_code, "")); CHKRET(easysrc_add(&easysrc_code, "curl_easy_cleanup(hnd);")); CHKRET(easysrc_add(&easysrc_code, "hnd = NULL;")); return CURLE_OK; }
CURLcode easysrc_perform(void) { /* Note any setopt calls which we could not convert */ if(easysrc_toohard) { int i; struct curl_slist *ptr; const char *c; CHKRET(easysrc_add(&easysrc_code, "")); /* Preamble comment */ for(i=0; ((c = srchard[i]) != NULL); i++) CHKRET(easysrc_add(&easysrc_code, c)); /* Each unconverted option */ for(ptr=easysrc_toohard; ptr; ptr = ptr->next) CHKRET(easysrc_add(&easysrc_code, ptr->data)); CHKRET(easysrc_add(&easysrc_code, "")); CHKRET(easysrc_add(&easysrc_code, "*/")); curl_slist_free_all(easysrc_toohard); easysrc_toohard = NULL; } CHKRET(easysrc_add(&easysrc_code, "")); CHKRET(easysrc_add(&easysrc_code, "ret = curl_easy_perform(hnd);")); CHKRET(easysrc_add(&easysrc_code, "")); return CURLE_OK; }
CURLcode easysrc_addf(struct curl_slist **plist, const char *fmt, ...) { CURLcode ret; char *bufp; va_list ap; va_start(ap, fmt); bufp = curlx_mvaprintf(fmt, ap); va_end(ap); if(! bufp) { ret = CURLE_OUT_OF_MEMORY; } else { ret = easysrc_add(plist, bufp); curl_free(bufp); } return ret; }
CURLcode easysrc_init(void) { CHKRET(easysrc_add(&easysrc_code, "hnd = curl_easy_init();")); return CURLE_OK; }