← Commit list

74bd3e2f98

Patrick Monnerat
Patrick Monnerat
2025-11-25
SUCCESS Duration: 357s

Subject

slist: constify Curl_slist_append_nodup() string argument

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/slist.c+3 -2
@@ -58,7 +58,8 @@ static struct curl_slist *slist_get_last(struct curl_slist *list)
* If an error occurs, NULL is returned and the string argument is NOT
* released.
*/
-struct curl_slist *Curl_slist_append_nodup(struct curl_slist *list, char *data)
+struct curl_slist *Curl_slist_append_nodup(struct curl_slist *list,
+ const char *data)
{
struct curl_slist *last;
struct curl_slist *new_item;
@@ -70,7 +71,7 @@ struct curl_slist *Curl_slist_append_nodup(struct curl_slist *list, char *data)
return NULL;
new_item->next = NULL;
- new_item->data = data;
+ new_item->data = CURL_UNCONST(data);
/* if this is the first item, then new_item *is* the list */
if(!list)
lib/slist.h+1 -1
@@ -36,6 +36,6 @@ struct curl_slist *Curl_slist_duplicate(struct curl_slist *inlist);
* it to the list.
*/
struct curl_slist *Curl_slist_append_nodup(struct curl_slist *list,
- char *data);
+ const char *data);
#endif /* HEADER_CURL_SLIST_H */