]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib: make Curl_easyopts const 16950/head
authorDan Fandrich <dan@coneharvesters.com>
Thu, 3 Apr 2025 20:41:50 +0000 (13:41 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Thu, 3 Apr 2025 20:43:26 +0000 (13:43 -0700)
Also, make the optiontable rule work in an out-of-tree build.

Closes #16950

lib/Makefile.am
lib/easygetopt.c
lib/easyoptions.c
lib/easyoptions.h
lib/optiontable.pl

index b8aaadab80ac2a2991e4788c3b4439223993ddb1..b10c9a13beb3ffb6fc716ac54993d27ba9df9cec 100644 (file)
@@ -185,7 +185,7 @@ tidy:
        $(TIDY) $$_csources $(TIDYFLAGS) $(CURL_CLANG_TIDYFLAGS) -- $(AM_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H)
 
 optiontable:
-       perl optiontable.pl < $(top_srcdir)/include/curl/curl.h > easyoptions.c
+       @PERL@ $(srcdir)/optiontable.pl < $(top_srcdir)/include/curl/curl.h > $(srcdir)/easyoptions.c
 
 if HAVE_WINDRES
 .rc.lo:
index 86833bf6b9e3e479b813da869923717693fb5ffb..5d30d39a49f2c2bf3d86593e8b643262a34d8736 100644 (file)
 #ifndef CURL_DISABLE_GETOPTIONS
 
 /* Lookups easy options at runtime */
-static struct curl_easyoption *lookup(const char *name, CURLoption id)
+static const struct curl_easyoption *lookup(const char *name, CURLoption id)
 {
   DEBUGASSERT(name || id);
   DEBUGASSERT(!Curl_easyopts_check());
   if(name || id) {
-    struct curl_easyoption *o = &Curl_easyopts[0];
+    const struct curl_easyoption *o = &Curl_easyopts[0];
     do {
       if(name) {
         if(strcasecompare(o->name, name))
index be617b5d2a21ec9b2cd527132922a8dfb2e70f41..860aa4c2ba45d83958b851d185b90e0c32932607 100644 (file)
@@ -28,7 +28,7 @@
 #include "easyoptions.h"
 
 /* all easy setopt options listed in alphabetical order */
-struct curl_easyoption Curl_easyopts[] = {
+const struct curl_easyoption Curl_easyopts[] = {
   {"ABSTRACT_UNIX_SOCKET", CURLOPT_ABSTRACT_UNIX_SOCKET, CURLOT_STRING, 0},
   {"ACCEPTTIMEOUT_MS", CURLOPT_ACCEPTTIMEOUT_MS, CURLOT_LONG, 0},
   {"ACCEPT_ENCODING", CURLOPT_ACCEPT_ENCODING, CURLOT_STRING, 0},
index 24b4cd93ed9b4d1b7365397a6e4be7e1fb830bab..44b6a8280a8f8effee1ad360a40480287c24a6f3 100644 (file)
@@ -29,7 +29,7 @@
 #include <curl/curl.h>
 
 /* generated table with all easy options */
-extern struct curl_easyoption Curl_easyopts[];
+extern const struct curl_easyoption Curl_easyopts[];
 
 #ifdef DEBUGBUILD
 int Curl_easyopts_check(void);
index 350262c70f1b4d0a392e09a417b86c191fdc6893..b1fa69d98271d3afff28c7ed2c1520c13d3169d5 100755 (executable)
@@ -31,7 +31,7 @@ print <<HEAD
 #include "easyoptions.h"
 
 /* all easy setopt options listed in alphabetical order */
-struct curl_easyoption Curl_easyopts[] = {
+const struct curl_easyoption Curl_easyopts[] = {
 HEAD
     ;