]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
urlapi: take const args in _dup and _get functions
authorrcombs <rcombs@rcombs.me>
Wed, 8 Mar 2023 08:18:39 +0000 (02:18 -0600)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 8 Mar 2023 14:38:26 +0000 (15:38 +0100)
Closes #10708

include/curl/urlapi.h
lib/urlapi.c

index b97b53475a940cccd668efcddddc248d360b55de..b3504b683af792f8b08c7aee57235e309bc341e6 100644 (file)
@@ -117,14 +117,14 @@ CURL_EXTERN void curl_url_cleanup(CURLU *handle);
  * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new
  * handle must also be freed with curl_url_cleanup().
  */
-CURL_EXTERN CURLU *curl_url_dup(CURLU *in);
+CURL_EXTERN CURLU *curl_url_dup(const CURLU *in);
 
 /*
  * curl_url_get() extracts a specific part of the URL from a CURLU
  * handle. Returns error code. The returned pointer MUST be freed with
  * curl_free() afterwards.
  */
-CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what,
+CURL_EXTERN CURLUcode curl_url_get(const CURLU *handle, CURLUPart what,
                                    char **part, unsigned int flags);
 
 /*
index fca1fc74d71180742f384286cf7c0608bcb9a4a9..62e32330648ca0180e7758e3b11af2b62f903c43 100644 (file)
@@ -1350,7 +1350,7 @@ void curl_url_cleanup(CURLU *u)
     }                                           \
   } while(0)
 
-CURLU *curl_url_dup(CURLU *in)
+CURLU *curl_url_dup(const CURLU *in)
 {
   struct Curl_URL *u = calloc(sizeof(struct Curl_URL), 1);
   if(u) {
@@ -1371,10 +1371,10 @@ CURLU *curl_url_dup(CURLU *in)
   return NULL;
 }
 
-CURLUcode curl_url_get(CURLU *u, CURLUPart what,
+CURLUcode curl_url_get(const CURLU *u, CURLUPart what,
                        char **part, unsigned int flags)
 {
-  char *ptr;
+  const char *ptr;
   CURLUcode ifmissing = CURLUE_UNKNOWN_PART;
   char portbuf[7];
   bool urldecode = (flags & CURLU_URLDECODE)?1:0;