tests: constify, make consts static

- lib509: constify an input string.
- add `static` to const data, where missing.
- tool1394: fix indentation.

Closes #17736
This commit is contained in:
Viktor Szakats 2025-06-24 16:50:23 +02:00
parent db512ee267
commit 1ec0da0149
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
14 changed files with 33 additions and 32 deletions

View file

@ -1900,7 +1900,7 @@ static char bigpart[120000];
*/
static int huge(void)
{
const char *smallpart = "c";
static const char *smallpart = "c";
int i;
CURLU *urlp = curl_url();
CURLUcode rc;
@ -1954,7 +1954,7 @@ static int huge(void)
static int urldup(void)
{
const char *url[] = {
static const char *url[] = {
"http://"
"user:pwd@"
"[2a04:4e42:e00::347%25eth0]"

View file

@ -44,7 +44,7 @@ static CURLcode test_lib1948(char *URL)
{
CURL *curl;
CURLcode res = CURLE_OK;
const char *testput = "This is test PUT data\n";
static const char *testput = "This is test PUT data\n";
put_buffer pbuf;
curl_global_init(CURL_GLOBAL_DEFAULT);

View file

@ -46,8 +46,8 @@ static bool is_chain_in_order(struct curl_certinfo *cert_info)
/* Find the certificate issuer and subject by enumerating each field */
for(; slist && (!issuer || !subject); slist = slist->next) {
const char issuer_prefix[] = "Issuer:";
const char subject_prefix[] = "Subject:";
static const char issuer_prefix[] = "Issuer:";
static const char subject_prefix[] = "Subject:";
if(!strncmp(slist->data, issuer_prefix, sizeof(issuer_prefix)-1)) {
issuer = slist->data + sizeof(issuer_prefix)-1;

View file

@ -42,8 +42,9 @@ static CURLcode test_lib505(char *URL)
struct curl_slist *hl;
struct curl_slist *headerlist = NULL;
const char *buf_1 = "RNFR 505";
const char *buf_2 = "RNTO 505-forreal";
static const char *buf_1 = "RNFR 505";
static const char *buf_2 = "RNTO 505-forreal";
if(!libtest_arg2) {
curl_mfprintf(stderr, "Usage: <url> <file-to-upload>\n");

View file

@ -69,8 +69,8 @@ static void custom_free(void *ptr)
static CURLcode test_lib509(char *URL)
{
unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
static const unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
CURLcode res;
CURL *curl;
int asize;
@ -98,7 +98,7 @@ static CURLcode test_lib509(char *URL)
test_setopt(curl, CURLOPT_USERAGENT, "test509"); /* uses strdup() */
asize = (int)sizeof(a);
str = curl_easy_escape(curl, (char *)a, asize); /* uses realloc() */
str = curl_easy_escape(curl, (const char *)a, asize); /* uses realloc() */
if(seen)
curl_mprintf("Callbacks were invoked!\n");

View file

@ -53,7 +53,7 @@ again:
if(!res) {
/* we are connected, now get an HTTP document the raw way */
const char *request =
static const char *request =
"GET /556 HTTP/1.1\r\n"
"Host: ninja\r\n\r\n";
const char *sbuf = request;

View file

@ -320,7 +320,7 @@ OM_uint32 gss_display_status(OM_uint32 *min,
OM_uint32 *message_context,
gss_buffer_t status_string)
{
const char maj_str[] = "Stub GSS error";
static const char maj_str[] = "Stub GSS error";
(void)mech_type;
if(min)
*min = 0;