Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation errors caused by function declarations without parameters #23

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,39 @@ static cjose_alloc3_fn_t _alloc3;
static cjose_realloc3_fn_t _realloc3;
static cjose_dealloc3_fn_t _dealloc3;

void *cjose_alloc_wrapped(size_t n) { return cjose_get_alloc3()(n, __FILE__, __LINE__); }
void *cjose_realloc_wrapped(void *p, size_t n) { return cjose_get_realloc3()(p, n, __FILE__, __LINE__); }
void cjose_dealloc_wrapped(void *p) { cjose_get_dealloc3()(p, __FILE__, __LINE__); }
void *cjose_alloc_wrapped(size_t n) { return cjose_get_alloc3(void)(n, __FILE__, __LINE__); }
void *cjose_realloc_wrapped(void *p, size_t n) { return cjose_get_realloc3(void)(p, n, __FILE__, __LINE__); }
void cjose_dealloc_wrapped(void *p) { cjose_get_dealloc3(void)(p, __FILE__, __LINE__); }

void *cjose_alloc3_default(size_t n, const char *file, int line)
{
CJOSE_UNUSED_PARAM(file);
CJOSE_UNUSED_PARAM(line);
return cjose_get_alloc()(n);
return cjose_get_alloc(void)(n);
}

void *cjose_realloc3_default(void *p, size_t n, const char *file, int line)
{
CJOSE_UNUSED_PARAM(file);
CJOSE_UNUSED_PARAM(line);
return cjose_get_realloc()(p, n);
return cjose_get_realloc(void)(p, n);
}

void cjose_dealloc3_default(void *p, const char *file, int line)
{
CJOSE_UNUSED_PARAM(file);
CJOSE_UNUSED_PARAM(line);
cjose_get_dealloc()(p);
cjose_get_dealloc(void)(p);
}

static void cjose_apply_allocs(void)
{
// set upstream
json_set_alloc_funcs(cjose_get_alloc(), cjose_get_dealloc());
json_set_alloc_funcs(cjose_get_alloc(void), cjose_get_dealloc(void));
#if defined(CJOSE_OPENSSL_11X)
CRYPTO_set_mem_functions(cjose_get_alloc3(), cjose_get_realloc3(), cjose_get_dealloc3());
CRYPTO_set_mem_functions(cjose_get_alloc3(void), cjose_get_realloc3(void), cjose_get_dealloc3(void));
#else
CRYPTO_set_mem_functions(cjose_get_alloc(), cjose_get_realloc(), cjose_get_dealloc());
CRYPTO_set_mem_functions(cjose_get_alloc(void), cjose_get_realloc(void), cjose_get_dealloc(void));
#endif
}

Expand All @@ -67,7 +67,7 @@ void cjose_set_alloc_funcs(cjose_alloc_fn_t alloc, cjose_realloc_fn_t realloc, c
_realloc3 = cjose_realloc3_default;
_dealloc3 = cjose_dealloc3_default;

cjose_apply_allocs();
cjose_apply_allocs(void);
}

void cjose_set_alloc_ex_funcs(cjose_alloc3_fn_t alloc3, cjose_realloc3_fn_t realloc3, cjose_dealloc3_fn_t dealloc3)
Expand All @@ -80,7 +80,7 @@ void cjose_set_alloc_ex_funcs(cjose_alloc3_fn_t alloc3, cjose_realloc3_fn_t real
_realloc = (NULL != realloc3) ? cjose_realloc_wrapped : NULL;
_dealloc = (NULL != dealloc3) ? cjose_dealloc_wrapped : NULL;

cjose_apply_allocs();
cjose_apply_allocs(void);
}

cjose_alloc_fn_t cjose_get_alloc(void) { return (!_alloc) ? malloc : _alloc; }
Expand Down Expand Up @@ -116,7 +116,7 @@ char *_cjose_strndup(const char *str, ssize_t len, cjose_err *err)
len = strlen(str);
}

char *result = cjose_get_alloc()(sizeof(char) * (len + 1));
char *result = cjose_get_alloc(void)(sizeof(char) * (len + 1));
if (!result)
{
CJOSE_ERROR(err, CJOSE_ERR_NO_MEMORY);
Expand All @@ -143,7 +143,7 @@ json_t *_cjose_json_stringn(const char *value, size_t len, cjose_err *err)
CJOSE_ERROR(err, CJOSE_ERR_NO_MEMORY);
return NULL;
}
cjose_get_dealloc()(s);
cjose_get_dealloc(void)(s);
#else
result = json_stringn(value, len);
if (!result)
Expand Down
Loading