diff options
author | David Robillard <d@drobilla.net> | 2022-01-02 22:52:39 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | d76b4da8f420a320b830544288c555a284151773 (patch) | |
tree | 1dc784440d32338dfe20315274982e56bb4bfca5 /src | |
parent | 828c1018f38bab9a930cecce64646366d051d39b (diff) | |
download | serd-d76b4da8f420a320b830544288c555a284151773.tar.gz serd-d76b4da8f420a320b830544288c555a284151773.tar.bz2 serd-d76b4da8f420a320b830544288c555a284151773.zip |
Remove datatype arguments from integer and base64 constructors
Diffstat (limited to 'src')
-rw-r--r-- | src/node.c | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -631,26 +631,28 @@ serd_new_decimal(const double d, const SerdNode* const datatype) } SerdNode* -serd_new_integer(const int64_t i, const SerdNode* const datatype) +serd_new_integer(const int64_t i) { // Use given datatype, or xsd:integer as a default if it is null - const SerdNode* type = datatype ? datatype : &serd_xsd_integer.node; - const size_t type_size = serd_node_total_size(type); + const SerdNode* datatype = &serd_xsd_integer.node; + const size_t datatype_size = serd_node_total_size(datatype); // Measure integer string to know how much space the node will need ExessResult r = exess_write_long(i, 0, NULL); assert(!r.status); // Allocate node with enough space for value and datatype URI - SerdNode* const node = serd_node_malloc( - serd_node_pad_length(r.count) + type_size, SERD_HAS_DATATYPE, SERD_LITERAL); + SerdNode* const node = + serd_node_malloc(serd_node_pad_length(r.count) + datatype_size, + SERD_HAS_DATATYPE, + SERD_LITERAL); // Write string directly into node r = exess_write_long(i, r.count + 1U, serd_node_buffer(node)); assert(!r.status); node->length = r.count; - memcpy(serd_node_meta(node), type, type_size); + memcpy(serd_node_meta(node), datatype, datatype_size); serd_node_check_padding(node); return node; } @@ -668,13 +670,13 @@ write_base64_literal(const void* const user_data, } SerdNode* -serd_new_base64(const void* buf, size_t size, const SerdNode* datatype) +serd_new_base64(const void* buf, size_t size) { const size_t len = exess_write_base64(size, buf, 0, NULL).count; - const SerdNode* type = datatype ? datatype : &serd_xsd_base64Binary.node; SerdConstBuffer blob = {buf, size}; - return serd_new_custom_literal(&blob, len, write_base64_literal, type); + return serd_new_custom_literal( + &blob, len, write_base64_literal, &serd_xsd_base64Binary.node); } SerdNodeType |