aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-09-30 17:20:21 +0200
committerDavid Robillard <d@drobilla.net>2018-09-30 17:20:21 +0200
commitf0bc2210cdcbb0d641e3a723ca23409afe615535 (patch)
tree98ac3edb553ef013096d204f633089a2e7af7744 /src
parenta5b040e33d00a8d6eab1ba8167f5ccaecbbfbc75 (diff)
downloadserd-f0bc2210cdcbb0d641e3a723ca23409afe615535.tar.gz
serd-f0bc2210cdcbb0d641e3a723ca23409afe615535.tar.bz2
serd-f0bc2210cdcbb0d641e3a723ca23409afe615535.zip
Fix calloc argument order
Diffstat (limited to 'src')
-rw-r--r--src/env.c2
-rw-r--r--src/node.c2
-rw-r--r--src/serd_internal.h2
-rw-r--r--src/uri.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/env.c b/src/env.c
index dca34365..b26c6b20 100644
--- a/src/env.c
+++ b/src/env.c
@@ -34,7 +34,7 @@ struct SerdEnvImpl {
SerdEnv*
serd_env_new(const SerdNode* base_uri)
{
- SerdEnv* env = (SerdEnv*)calloc(sizeof(struct SerdEnvImpl), 1);
+ SerdEnv* env = (SerdEnv*)calloc(1, sizeof(struct SerdEnvImpl));
if (env && base_uri) {
serd_env_set_base_uri(env, base_uri);
}
diff --git a/src/node.c b/src/node.c
index 655da1d1..92bf3bde 100644
--- a/src/node.c
+++ b/src/node.c
@@ -360,7 +360,7 @@ SerdNode
serd_node_new_blob(const void* buf, size_t size, bool wrap_lines)
{
const size_t len = (size + 2) / 3 * 4 + (wrap_lines * ((size - 1) / 57));
- uint8_t* str = (uint8_t*)calloc(1, len + 2);
+ uint8_t* str = (uint8_t*)calloc(len + 2, 1);
SerdNode node = { str, len, len, 0, SERD_LITERAL };
for (size_t i = 0, j = 0; i < size; i += 3, j += 4) {
uint8_t in[4] = { 0, 0, 0, 0 };
diff --git a/src/serd_internal.h b/src/serd_internal.h
index 47b1ab98..0bc1cf42 100644
--- a/src/serd_internal.h
+++ b/src/serd_internal.h
@@ -176,7 +176,7 @@ static inline SerdStack
serd_stack_new(size_t size)
{
SerdStack stack;
- stack.buf = (uint8_t*)calloc(1, size);
+ stack.buf = (uint8_t*)calloc(size, 1);
stack.buf_size = size;
stack.size = SERD_STACK_BOTTOM;
return stack;
diff --git a/src/uri.c b/src/uri.c
index 6ec6f1c7..249b2674 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -60,7 +60,7 @@ serd_file_uri_parse(const uint8_t* uri, uint8_t** hostname)
return NULL;
}
if (hostname) {
- *hostname = (uint8_t*)calloc(1, path - auth + 1);
+ *hostname = (uint8_t*)calloc(path - auth + 1, 1);
memcpy(*hostname, auth, path - auth);
}
}