aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-13 11:22:18 +0100
committerDavid Robillard <d@drobilla.net>2021-03-07 15:32:23 -0500
commitc0410fab52f4e2e36c2779a6ec8dc9ef89a8ee58 (patch)
treed23d782c96ae4ed4e26bdb3a8c9343175364986d /src
parent3ec66799f0b9be2f83251721f91a8b913abd29ec (diff)
downloadserd-c0410fab52f4e2e36c2779a6ec8dc9ef89a8ee58.tar.gz
serd-c0410fab52f4e2e36c2779a6ec8dc9ef89a8ee58.tar.bz2
serd-c0410fab52f4e2e36c2779a6ec8dc9ef89a8ee58.zip
Shorten node constructor names
Diffstat (limited to 'src')
-rw-r--r--src/env.c6
-rw-r--r--src/node.c38
-rw-r--r--src/serdi.c4
3 files changed, 23 insertions, 25 deletions
diff --git a/src/env.c b/src/env.c
index caf50b08..39da7a46 100644
--- a/src/env.c
+++ b/src/env.c
@@ -88,7 +88,7 @@ serd_env_set_base_uri(SerdEnv* env, const SerdNode* uri)
// Resolve base URI and create a new node and URI for it
SerdURIView base_uri;
SerdNode base_uri_node =
- serd_node_new_uri_from_node(uri, &env->base_uri, &base_uri);
+ serd_new_uri_from_node(uri, &env->base_uri, &base_uri);
// Replace the current base URI
serd_node_free(&env->base_uri_node);
@@ -145,7 +145,7 @@ serd_env_set_prefix(SerdEnv* env, const SerdNode* name, const SerdNode* uri)
// Resolve relative URI and create a new node and URI for it
SerdURIView abs_uri;
SerdNode abs_uri_node =
- serd_node_new_uri_from_node(uri, &env->base_uri, &abs_uri);
+ serd_new_uri_from_node(uri, &env->base_uri, &abs_uri);
// Set prefix to resolved (absolute) URI
serd_env_add(env, name, &abs_uri_node);
@@ -219,7 +219,7 @@ serd_env_expand_node(const SerdEnv* env, const SerdNode* node)
break;
case SERD_URI: {
SerdURIView ignored;
- return serd_node_new_uri_from_node(node, &env->base_uri, &ignored);
+ return serd_new_uri_from_node(node, &env->base_uri, &ignored);
}
case SERD_CURIE: {
SerdStringView prefix;
diff --git a/src/node.c b/src/node.c
index 999e0164..59407243 100644
--- a/src/node.c
+++ b/src/node.c
@@ -115,28 +115,28 @@ string_sink(const void* buf, size_t len, void* stream)
}
SerdNode
-serd_node_new_uri_from_node(const SerdNode* uri_node,
- const SerdURIView* base,
- SerdURIView* out)
+serd_new_uri_from_node(const SerdNode* uri_node,
+ const SerdURIView* base,
+ SerdURIView* out)
{
return (uri_node->type == SERD_URI && uri_node->buf)
- ? serd_node_new_uri_from_string(uri_node->buf, base, out)
+ ? serd_new_uri_from_string(uri_node->buf, base, out)
: SERD_NODE_NULL;
}
SerdNode
-serd_node_new_uri_from_string(const char* str,
- const SerdURIView* base,
- SerdURIView* out)
+serd_new_uri_from_string(const char* str,
+ const SerdURIView* base,
+ SerdURIView* out)
{
if (!str || str[0] == '\0') {
// Empty URI => Base URI, or nothing if no base is given
- return base ? serd_node_new_uri(base, NULL, out) : SERD_NODE_NULL;
+ return base ? serd_new_uri(base, NULL, out) : SERD_NODE_NULL;
}
SerdURIView uri;
serd_uri_parse(str, &uri);
- return serd_node_new_uri(&uri, base, out); // Resolve/Serialise
+ return serd_new_uri(&uri, base, out); // Resolve/Serialise
}
static inline bool
@@ -176,7 +176,7 @@ is_uri_path_char(const char c)
}
SerdNode
-serd_node_new_file_uri(const char* path, const char* hostname, SerdURIView* out)
+serd_new_file_uri(const char* path, const char* hostname, SerdURIView* out)
{
const size_t path_len = strlen(path);
const size_t hostname_len = hostname ? strlen(hostname) : 0;
@@ -224,9 +224,7 @@ serd_node_new_file_uri(const char* path, const char* hostname, SerdURIView* out)
}
SerdNode
-serd_node_new_uri(const SerdURIView* uri,
- const SerdURIView* base,
- SerdURIView* out)
+serd_new_uri(const SerdURIView* uri, const SerdURIView* base, SerdURIView* out)
{
SerdURIView abs_uri = *uri;
if (base) {
@@ -250,10 +248,10 @@ serd_node_new_uri(const SerdURIView* uri,
}
SerdNode
-serd_node_new_relative_uri(const SerdURIView* uri,
- const SerdURIView* base,
- const SerdURIView* root,
- SerdURIView* out)
+serd_new_relative_uri(const SerdURIView* uri,
+ const SerdURIView* base,
+ const SerdURIView* root,
+ SerdURIView* out)
{
const size_t uri_len = serd_uri_string_length(uri);
const size_t base_len = serd_uri_string_length(base);
@@ -281,7 +279,7 @@ serd_digits(double abs)
}
SerdNode
-serd_node_new_decimal(double d, unsigned frac_digits)
+serd_new_decimal(double d, unsigned frac_digits)
{
if (isnan(d) || isinf(d)) {
return SERD_NODE_NULL;
@@ -336,7 +334,7 @@ serd_node_new_decimal(double d, unsigned frac_digits)
}
SerdNode
-serd_node_new_integer(int64_t i)
+serd_new_integer(int64_t i)
{
uint64_t abs_i = (i < 0) ? -i : i;
const unsigned digits = serd_digits((double)abs_i);
@@ -361,7 +359,7 @@ serd_node_new_integer(int64_t i)
}
SerdNode
-serd_node_new_blob(const void* buf, size_t size, bool wrap_lines)
+serd_new_blob(const void* buf, size_t size, bool wrap_lines)
{
const size_t len = serd_base64_get_length(size, wrap_lines);
uint8_t* str = (uint8_t*)calloc(len + 2, 1);
diff --git a/src/serdi.c b/src/serdi.c
index 68b1a497..f075ce13 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -311,9 +311,9 @@ main(int argc, char** argv)
SerdURIView base_uri = SERD_URI_NULL;
SerdNode base = SERD_NODE_NULL;
if (a < argc) { // Base URI given on command line
- base = serd_node_new_uri_from_string((const char*)argv[a], NULL, &base_uri);
+ base = serd_new_uri_from_string((const char*)argv[a], NULL, &base_uri);
} else if (from_file && in_fd != stdin) { // Use input file URI
- base = serd_node_new_file_uri(input, NULL, &base_uri);
+ base = serd_new_file_uri(input, NULL, &base_uri);
}
FILE* const out_fd = stdout;