From: Viktor Szakats Date: Thu, 24 Jul 2025 00:34:39 +0000 (+0200) Subject: servers: convert two macros to scoped static const strings X-Git-Tag: curl-8_16_0~342 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bdef96abaf0f664dd737dc06d218576d22545e8;p=thirdparty%2Fcurl.git servers: convert two macros to scoped static const strings Closes #18067 --- diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c index b6dd5ead1e..d046fdf420 100644 --- a/tests/server/rtspd.c +++ b/tests/server/rtspd.c @@ -716,19 +716,19 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req) default: case RCMD_NORMALREQ: break; /* continue with business as usual */ - case RCMD_STREAM: -#define STREAMTHIS "a string to stream 01234567890\n" - count = strlen(STREAMTHIS); + case RCMD_STREAM: { + static const char streamthis[] = "a string to stream 01234567890\n"; for(;;) { - written = swrite(sock, STREAMTHIS, count); + written = swrite(sock, streamthis, sizeof(streamthis)-1); if(got_exit_signal) return -1; - if(written != (ssize_t)count) { + if(written != (ssize_t)(sizeof(streamthis)-1)) { logmsg("Stopped streaming"); break; } } return -1; + } case RCMD_IDLE: /* Do nothing. Sit idle. Pretend it rains. */ return 0; diff --git a/tests/server/sws.c b/tests/server/sws.c index 4d43b38b1e..2ae4727ad6 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -959,19 +959,19 @@ static int sws_send_doc(curl_socket_t sock, struct sws_httprequest *req) default: case RCMD_NORMALREQ: break; /* continue with business as usual */ - case RCMD_STREAM: -#define STREAMTHIS "a string to stream 01234567890\n" - count = strlen(STREAMTHIS); + case RCMD_STREAM: { + static const char streamthis[] = "a string to stream 01234567890\n"; for(;;) { - written = swrite(sock, STREAMTHIS, count); + written = swrite(sock, streamthis, sizeof(streamthis)-1); if(got_exit_signal) return -1; - if(written != (ssize_t)count) { + if(written != (ssize_t)(sizeof(streamthis)-1)) { logmsg("Stopped streaming"); break; } } return -1; + } case RCMD_IDLE: /* Do nothing. Sit idle. Pretend it rains. */ return 0;