style: remove extra const keyword from interfaces

Const variables in prototypes don't add much value, but make the code
larger and redundant. Remove these const keywords.
Note, this doesn't apply to pointers to const memory.
This commit is contained in:
Dmitry Podgorny
2021-03-19 22:12:15 +02:00
parent 2d5424bcff
commit db8a511f68
33 changed files with 547 additions and 652 deletions

View File

@@ -16,9 +16,9 @@
static uint8_t char_to_bin(char c)
{
return c <= '9'
? (uint8_t)(c - '0')
: c <= 'Z' ? (uint8_t)(c - 'A' + 10) : (uint8_t)(c - 'a' + 10);
return c <= '9' ? (uint8_t)(c - '0')
: c <= 'Z' ? (uint8_t)(c - 'A' + 10)
: (uint8_t)(c - 'a' + 10);
}
void test_hex_to_bin(const char *hex, uint8_t *bin, size_t *bin_len)

View File

@@ -22,7 +22,7 @@ static int mem_alloc_called = 0;
static int mem_free_called = 0;
static int mem_realloc_called = 0;
void *my_alloc(const size_t size, void *const userdata)
void *my_alloc(size_t size, void *userdata)
{
(void)userdata;
@@ -30,7 +30,7 @@ void *my_alloc(const size_t size, void *const userdata)
return malloc(size);
}
void my_free(void *p, void *const userdata)
void my_free(void *p, void *userdata)
{
(void)userdata;
@@ -38,7 +38,7 @@ void my_free(void *p, void *const userdata)
return free(p);
}
void *my_realloc(void *p, const size_t size, void *const userdata)
void *my_realloc(void *p, size_t size, void *userdata)
{
(void)userdata;
@@ -46,10 +46,10 @@ void *my_realloc(void *p, const size_t size, void *const userdata)
return realloc(p, size);
}
void my_logger(void *const userdata,
const xmpp_log_level_t level,
const char *const area,
const char *const msg)
void my_logger(void *userdata,
xmpp_log_level_t level,
const char *area,
const char *msg)
{
if (strcmp((char *)userdata, "asdf") == 0 && level == XMPP_LEVEL_DEBUG &&
strcmp(area, "test") == 0 && strcmp(msg, "hello") == 0)

View File

@@ -21,14 +21,14 @@
#include "rand.c"
/* stubs to build test without whole libstrophe */
void *xmpp_alloc(const xmpp_ctx_t *const ctx, const size_t size)
void *xmpp_alloc(const xmpp_ctx_t *ctx, size_t size)
{
(void)ctx;
(void)size;
return NULL;
}
void xmpp_free(const xmpp_ctx_t *const ctx, void *p)
void xmpp_free(const xmpp_ctx_t *ctx, void *p)
{
(void)ctx;
(void)p;