misc: general C style cleanups

... in code that previously was not checksrc'ed

Closes #14625
This commit is contained in:
Daniel Stenberg 2024-08-22 11:04:17 +02:00
parent 42843af0b8
commit 99ba50d9c4
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
5 changed files with 218 additions and 206 deletions

View File

@ -103,8 +103,7 @@ int SYS$CRELNM(
/* Take all the fun out of simply looking up a logical name */
static int sys_trnlnm
(const char * logname,
static int sys_trnlnm(const char *logname,
char *value,
int value_len)
{
@ -141,8 +140,7 @@ static int sys_trnlnm
}
/* How to simply create a logical name */
static int sys_crelnm
(const char * logname,
static int sys_crelnm(const char *logname,
const char *value)
{
int ret_val;
@ -204,7 +202,7 @@ static void set_features(void)
int use_unix_settings = 1;
status = sys_trnlnm("GNV$UNIX_SHELL",
unix_shell_name, sizeof unix_shell_name -1);
unix_shell_name, sizeof(unix_shell_name) -1);
if(!$VMS_STATUS_SUCCESS(status)) {
use_unix_settings = 0;
}
@ -266,7 +264,8 @@ static void set_features(void)
set_feature_default("DECC$FILE_OWNER_UNIX", ENABLE);
set_feature_default("DECC$POSIX_SEEK_STREAM_FILE", ENABLE);
} else {
}
else {
set_feature_default("DECC$FILENAME_UNIX_REPORT", ENABLE);
}
@ -308,7 +307,7 @@ static void set_features(void)
# endif
#endif
/* Set our contribution to the LIB$INITIALIZE array */
void (* const iniarray[])(void) = {set_features, } ;
void (* const iniarray[])(void) = {set_features };
#ifndef __VAX
# if __INITIAL_POINTER_SIZE
# pragma __pointer_size __restore

View File

@ -40,9 +40,8 @@ unsigned long LIB$SET_SYMBOL(
const struct dsc$descriptor_s * value,
const unsigned long *table_type);
int main(int argc, char ** argv) {
int main(int argc, char **argv)
{
void *libptr;
const char * (*ssl_version)(int t);
const char *version;
@ -55,16 +54,16 @@ const char * version;
libptr = dlopen(argv[1], 0);
ssl_version = (const char * (*)(int))dlsym(libptr, "SSLeay_version");
if(ssl_version == NULL) {
if(!ssl_version) {
ssl_version = (const char * (*)(int))dlsym(libptr, "ssleay_version");
if(ssl_version == NULL) {
if(!ssl_version) {
ssl_version = (const char * (*)(int))dlsym(libptr, "SSLEAY_VERSION");
}
}
dlclose(libptr);
if(ssl_version == NULL) {
if(!ssl_version) {
puts("Unable to lookup version of OpenSSL");
exit(1);
}

View File

@ -75,7 +75,7 @@ create the thread local storage and that could be a problem for LoadLibrary.
Regarding the options that were added via C_EXTRA_FLAGS:
FP_MAX_BITS=16384
https://www.yassl.com/forums/topic423-cacertorgs-ca-cert-verify-failed-but-withdisablefastmath-it-works.html
https://www.wolfssl.com/documentation/manuals/wolfssl/chapter02.html
"Since root.crt uses a 4096-bit RSA key, you'll need to increase the fastmath
buffer size. You can do this using the define:
FP_MAX_BITS and setting it to 8192."

View File

@ -62,8 +62,8 @@ static const struct detail scheme[] = {
{"rtsp", "#ifndef CURL_DISABLE_RTSP" },
{"scp", "#if defined(USE_SSH) && !defined(USE_WOLFSSH)" },
{"sftp", "#if defined(USE_SSH)" },
{"smb", "#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \\\n"
" (SIZEOF_CURL_OFF_T > 4)" },
{"smb", "#if !defined(CURL_DISABLE_SMB) && \\\n"
" defined(USE_CURL_NTLM_CORE) && (SIZEOF_CURL_OFF_T > 4)" },
{"smbs", "#if defined(USE_SSL) && !defined(CURL_DISABLE_SMB) && \\\n"
" defined(USE_CURL_NTLM_CORE) && (SIZEOF_CURL_OFF_T > 4)" },
{"smtp", "#ifndef CURL_DISABLE_SMTP" },
@ -185,7 +185,6 @@ int main(void)
int j;
for(j = 0; j < i; j++) {
if(ix[j] == ix[i]) {
/* printf("NOPE, try %u causes dupes (%d and %d)\n", try, j, i); */
good = 0;
break;
}

View File

@ -42,7 +42,8 @@ static int curltest_tweak_handler(request_rec *r);
static int curltest_1_1_required(request_rec *r);
static int curltest_sslinfo_handler(request_rec *r);
AP_DECLARE_MODULE(curltest) = {
AP_DECLARE_MODULE(curltest) =
{
STANDARD20_MODULE_STUFF,
NULL, /* func to create per dir config */
NULL, /* func to merge per dir config */
@ -95,8 +96,8 @@ static void curltest_hooks(apr_pool_t *pool)
#define SECS_PER_HOUR (60*60)
#define SECS_PER_DAY (24*SECS_PER_HOUR)
static apr_status_t duration_parse(apr_interval_time_t *ptimeout, const char *value,
const char *def_unit)
static apr_status_t duration_parse(apr_interval_time_t *ptimeout,
const char *value, const char *def_unit)
{
char *endp;
apr_int64_t n;
@ -106,7 +107,8 @@ static apr_status_t duration_parse(apr_interval_time_t *ptimeout, const char *va
return errno;
}
if(!endp || !*endp) {
if (!def_unit) def_unit = "s";
if(!def_unit)
def_unit = "s";
}
else if(endp == value) {
return APR_EINVAL;
@ -254,7 +256,9 @@ static int curltest_echo_handler(request_rec *r)
bb = apr_brigade_create(r->pool, c->bucket_alloc);
/* copy any request body into the response */
if((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK))) goto cleanup;
rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK);
if(rv)
goto cleanup;
if(die_after_100) {
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
"echo_handler: dying after 100-continue");
@ -278,9 +282,11 @@ static int curltest_echo_handler(request_rec *r)
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
"echo_handler: copying %ld bytes from request body", l);
rv = apr_brigade_write(bb, NULL, NULL, buffer, l);
if (APR_SUCCESS != rv) goto cleanup;
if(APR_SUCCESS != rv)
goto cleanup;
rv = ap_pass_brigade(r->output_filters, bb);
if (APR_SUCCESS != rv) goto cleanup;
if(APR_SUCCESS != rv)
goto cleanup;
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
"echo_handler: passed %ld bytes from request body", l);
}
@ -460,7 +466,8 @@ static int curltest_tweak_handler(request_rec *r)
b = apr_bucket_flush_create(c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, b);
rv = ap_pass_brigade(r->output_filters, bb);
if (APR_SUCCESS != rv) goto cleanup;
if(APR_SUCCESS != rv)
goto cleanup;
memset(buffer, 'X', sizeof(buffer));
for(i = 0; i < chunks; ++i) {
@ -468,9 +475,11 @@ static int curltest_tweak_handler(request_rec *r)
apr_sleep(chunk_delay);
}
rv = apr_brigade_write(bb, NULL, NULL, buffer, chunk_size);
if(APR_SUCCESS != rv) goto cleanup;
if(APR_SUCCESS != rv)
goto cleanup;
rv = ap_pass_brigade(r->output_filters, bb);
if(APR_SUCCESS != rv) goto cleanup;
if(APR_SUCCESS != rv)
goto cleanup;
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
"error_handler: passed %lu bytes as response body",
(unsigned long)chunk_size);
@ -591,7 +600,9 @@ static int curltest_put_handler(request_rec *r)
}
bb = apr_brigade_create(r->pool, c->bucket_alloc);
/* copy any request body into the response */
if((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK))) goto cleanup;
rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK);
if(rv)
goto cleanup;
if(ap_should_client_block(r)) {
while(0 < (l = ap_get_client_block(r, &buffer[0], sizeof(buffer)))) {
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
@ -606,7 +617,8 @@ static int curltest_put_handler(request_rec *r)
s_rbody_len = apr_psprintf(r->pool, "%"APR_OFF_T_FMT, rbody_len);
apr_table_setn(r->headers_out, "Received-Length", s_rbody_len);
rv = apr_brigade_puts(bb, NULL, NULL, s_rbody_len);
if(APR_SUCCESS != rv) goto cleanup;
if(APR_SUCCESS != rv)
goto cleanup;
b = apr_bucket_eos_create(c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, b);
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "put_handler: request read");
@ -670,11 +682,13 @@ static int curltest_1_1_required(request_rec *r)
b = apr_bucket_flush_create(c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, b);
rv = ap_pass_brigade(r->output_filters, bb);
if (APR_SUCCESS != rv) goto cleanup;
if(APR_SUCCESS != rv)
goto cleanup;
/* we are done */
rv = apr_brigade_printf(bb, NULL, NULL, "well done!");
if(APR_SUCCESS != rv) goto cleanup;
if(APR_SUCCESS != rv)
goto cleanup;
b = apr_bucket_eos_create(c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, b);
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "1_1_handler: request read");
@ -781,7 +795,8 @@ static int curltest_sslinfo_handler(request_rec *r)
b = apr_bucket_flush_create(c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, b);
rv = ap_pass_brigade(r->output_filters, bb);
if (APR_SUCCESS != rv) goto cleanup;
if(APR_SUCCESS != rv)
goto cleanup;
/* we are done */
b = apr_bucket_eos_create(c->bucket_alloc);