Trivial refactoring to make future changes easier. --- plugins/curl/curldefs.h | 4 ++-- plugins/curl/curl.c | 18 +++++++++--------- plugins/curl/scripts.c | 14 +++++++------- 3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/plugins/curl/curldefs.h b/plugins/curl/curldefs.h index 16b6071cc..3d0efb718 100644 --- a/plugins/curl/curldefs.h +++ b/plugins/curl/curldefs.h @@ -66,7 +66,7 @@ extern const char *user; extern const char *user_agent; /* The per-connection handle. */ -struct curl_handle { +struct handle { CURL *c; int readonly; bool accept_range; @@ -80,7 +80,7 @@ struct curl_handle { }; /* scripts.c */ -extern int do_scripts (struct curl_handle *h); +extern int do_scripts (struct handle *h); extern void scripts_unload (void); #endif /* NBDKIT_CURLDEFS_H */ diff --git a/plugins/curl/curl.c b/plugins/curl/curl.c index 2f34d1dc1..9d7ba9d6d 100644 --- a/plugins/curl/curl.c +++ b/plugins/curl/curl.c @@ -452,7 +452,7 @@ static size_t read_cb (void *ptr, size_t size, size_t nmemb, void *opaque); static void * curl_open (int readonly) { - struct curl_handle *h; + struct handle *h; CURLcode r; #ifdef HAVE_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T curl_off_t o; @@ -729,7 +729,7 @@ debug_cb (CURL *handle, curl_infotype type, static size_t header_cb (void *ptr, size_t size, size_t nmemb, void *opaque) { - struct curl_handle *h = opaque; + struct handle *h = opaque; size_t realsize = size * nmemb; const char *header = ptr; const char *end = header + realsize; @@ -763,7 +763,7 @@ header_cb (void *ptr, size_t size, size_t nmemb, void *opaque) static void curl_close (void *handle) { - struct curl_handle *h = handle; + struct handle *h = handle; curl_easy_cleanup (h->c); if (h->headers_copy) @@ -777,7 +777,7 @@ curl_close (void *handle) static int64_t curl_get_size (void *handle) { - struct curl_handle *h = handle; + struct handle *h = handle; return h->exportsize; } @@ -789,7 +789,7 @@ curl_get_size (void *handle) static int curl_can_multi_conn (void *handle) { - struct curl_handle *h = handle; + struct handle *h = handle; return !! h->readonly; } @@ -806,7 +806,7 @@ curl_can_multi_conn (void *handle) static int curl_pread (void *handle, void *buf, uint32_t count, uint64_t offset) { - struct curl_handle *h = handle; + struct handle *h = handle; CURLcode r; char range[128]; @@ -846,7 +846,7 @@ curl_pread (void *handle, void *buf, uint32_t count, uint64_t offset) static size_t write_cb (char *ptr, size_t size, size_t nmemb, void *opaque) { - struct curl_handle *h = opaque; + struct handle *h = opaque; size_t orig_realsize = size * nmemb; size_t realsize = orig_realsize; @@ -870,7 +870,7 @@ write_cb (char *ptr, size_t size, size_t nmemb, void *opaque) static int curl_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset) { - struct curl_handle *h = handle; + struct handle *h = handle; CURLcode r; char range[128]; @@ -910,7 +910,7 @@ curl_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset) static size_t read_cb (void *ptr, size_t size, size_t nmemb, void *opaque) { - struct curl_handle *h = opaque; + struct handle *h = opaque; size_t realsize = size * nmemb; assert (h->read_buf); diff --git a/plugins/curl/scripts.c b/plugins/curl/scripts.c index fefdc0374..892f7da28 100644 --- a/plugins/curl/scripts.c +++ b/plugins/curl/scripts.c @@ -80,17 +80,17 @@ scripts_unload (void) free (cookies_from_script); } -static int run_header_script (struct curl_handle *); -static int run_cookie_script (struct curl_handle *); +static int run_header_script (struct handle *); +static int run_cookie_script (struct handle *); static void error_from_tmpfile (const char *what, const char *tmpfile); /* This is called from any thread just before we make a curl request. * * Because the thread model is NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS - * we can be assured of exclusive access to curl_handle here. + * we can be assured of exclusive access to handle here. */ int -do_scripts (struct curl_handle *h) +do_scripts (struct handle *h) { time_t now; struct curl_slist *p; @@ -163,7 +163,7 @@ do_scripts (struct curl_handle *h) * header-script. */ static int -run_header_script (struct curl_handle *h) +run_header_script (struct handle *h) { int fd; char tmpfile[] = "/tmp/errorsXXXXXX"; @@ -243,7 +243,7 @@ run_header_script (struct curl_handle *h) * cookie-script. */ static int -run_cookie_script (struct curl_handle *h) +run_cookie_script (struct handle *h) { int fd; char tmpfile[] = "/tmp/errorsXXXXXX"; @@ -352,7 +352,7 @@ scripts_unload (void) } int -do_scripts (struct curl_handle *h) +do_scripts (struct handle *h) { if (!header_script && !cookie_script) return 0; -- 2.39.0 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs