From 5dc8e901e07bcd63962c0f72eb62d074a4518650 Mon Sep 17 00:00:00 2001 From: Graham Percival Date: Wed, 7 Aug 2024 21:36:57 -0700 Subject: [PATCH] Comments: clarify remaining return statements --- datastruct/elasticarray.c | 1 + datastruct/timerqueue.c | 1 + http/http.c | 1 + netbuf/netbuf_read.c | 1 + netbuf/netbuf_write.c | 1 + network_ssl/network_ssl_compat.c | 2 ++ util/align_ptr.h | 2 ++ util/json.c | 2 ++ 8 files changed, 11 insertions(+) diff --git a/datastruct/elasticarray.c b/datastruct/elasticarray.c index 8b1e7d61..24857d16 100644 --- a/datastruct/elasticarray.c +++ b/datastruct/elasticarray.c @@ -272,6 +272,7 @@ void * elasticarray_get(struct elasticarray * EA, size_t pos, size_t reclen) { + /* Calculate the pointer address. */ return ((uint8_t *)(EA->buf) + pos * reclen); } diff --git a/datastruct/timerqueue.c b/datastruct/timerqueue.c index 03bd81df..d5594df0 100644 --- a/datastruct/timerqueue.c +++ b/datastruct/timerqueue.c @@ -47,6 +47,7 @@ compar(void * cookie, const void * x, const void * y) (void)cookie; /* UNUSED */ + /* Compare the times. */ return (tvcmp(&_x->tv, &_y->tv)); } diff --git a/http/http.c b/http/http.c index 7a5fcd54..70b30ac5 100644 --- a/http/http.c +++ b/http/http.c @@ -244,6 +244,7 @@ http_request(struct sock_addr * const * addrs, struct http_request * request, void * cookie) { + /* Call the real function (without SSL). */ return (http_request2(addrs, request, maxrlen, callback, cookie, NULL)); } diff --git a/netbuf/netbuf_read.c b/netbuf/netbuf_read.c index 04d715a8..e0bc6d67 100644 --- a/netbuf/netbuf_read.c +++ b/netbuf/netbuf_read.c @@ -50,6 +50,7 @@ struct netbuf_read * netbuf_read_init(int s) { + /* Call the real function (without SSL). */ return (netbuf_read_init2(s, NULL)); } diff --git a/netbuf/netbuf_write.c b/netbuf/netbuf_write.c index 18aeee4f..d5dc9902 100644 --- a/netbuf/netbuf_write.c +++ b/netbuf/netbuf_write.c @@ -160,6 +160,7 @@ struct netbuf_write * netbuf_write_init(int s, int (* fail_callback)(void *), void * fail_cookie) { + /* Call the real function (without SSL). */ return (netbuf_write_init2(s, NULL, fail_callback, fail_cookie)); } diff --git a/network_ssl/network_ssl_compat.c b/network_ssl/network_ssl_compat.c index cf359e54..c59b1c11 100644 --- a/network_ssl/network_ssl_compat.c +++ b/network_ssl/network_ssl_compat.c @@ -70,6 +70,8 @@ network_ssl_compat_set1_host(SSL * ssl, const char * hostname) X509_VERIFY_PARAM * param; param = SSL_get0_param(ssl); + + /* Use older OpenSSL function. */ return (X509_VERIFY_PARAM_set1_host(param, hostname, strlen(hostname))); } #endif diff --git a/util/align_ptr.h b/util/align_ptr.h index 70cfa99a..ebe3e0f9 100644 --- a/util/align_ptr.h +++ b/util/align_ptr.h @@ -44,6 +44,8 @@ align_ptr(uint8_t * arr, size_t alignment) */ offset = (uintptr_t)(&arr[0]) % alignment; offset = (alignment - offset) % alignment; + + /* Return the aligned pointer. */ return ((void *)&arr[offset]); } diff --git a/util/json.c b/util/json.c index f6f92864..f651c704 100644 --- a/util/json.c +++ b/util/json.c @@ -85,6 +85,8 @@ skip_number(const uint8_t * buf, const uint8_t * end) break; buf++; } + + /* Return our current position. */ return (buf); }