aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-format9
-rw-r--r--doc/Doxyfile.in14
-rw-r--r--include/serd/attributes.h35
-rw-r--r--include/serd/buffer.h18
-rw-r--r--include/serd/caret.h28
-rw-r--r--include/serd/env.h45
-rw-r--r--include/serd/error.h12
-rw-r--r--include/serd/event.h25
-rw-r--r--include/serd/memory.h2
-rw-r--r--include/serd/node.h94
-rw-r--r--include/serd/reader.h49
-rw-r--r--include/serd/sink.h70
-rw-r--r--include/serd/statement.h61
-rw-r--r--include/serd/status.h3
-rw-r--r--include/serd/stream.h19
-rw-r--r--include/serd/string.h11
-rw-r--r--include/serd/string_view.h14
-rw-r--r--include/serd/syntax.h5
-rw-r--r--include/serd/uri.h19
-rw-r--r--include/serd/world.h20
-rw-r--r--include/serd/writer.h32
-rw-r--r--meson.build3
-rw-r--r--src/byte_source.h4
-rw-r--r--src/env.c3
-rw-r--r--src/env.h4
-rw-r--r--src/node.c14
-rw-r--r--src/node.h36
-rw-r--r--src/reader.h5
-rw-r--r--src/statement.h16
-rw-r--r--src/system.h8
-rw-r--r--src/uri_utils.h6
-rw-r--r--test/headers/meson.build2
-rw-r--r--test/headers/test_headers.c3
-rw-r--r--test/test_string.c4
34 files changed, 355 insertions, 338 deletions
diff --git a/.clang-format b/.clang-format
index f6c9d6eb..66822e05 100644
--- a/.clang-format
+++ b/.clang-format
@@ -22,16 +22,15 @@ IndentPPDirectives: AfterHash
KeepEmptyLinesAtTheStartOfBlocks: false
SpacesInContainerLiterals: false
AttributeMacros:
- - SERD_ALLOCATED
- - SERD_ALWAYS_INLINE_FUNC
- SERD_API
- SERD_CONST_API
- - SERD_CONST_FUNC
- SERD_FALLTHROUGH
- SERD_MALLOC_API
- - SERD_MALLOC_FUNC
- SERD_PURE_API
- - SERD_PURE_FUNC
+ - ZIX_ALWAYS_INLINE_FUNC
+ - ZIX_CONST_FUNC
+ - ZIX_MALLOC_FUNC
+ - ZIX_PURE_FUNC
StatementMacros:
- SERD_LOG_FUNC
- _Pragma
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
index 8952aa2c..75f9b139 100644
--- a/doc/Doxyfile.in
+++ b/doc/Doxyfile.in
@@ -23,16 +23,16 @@ XML_PROGRAMLISTING = NO
SHOW_FILES = NO
MACRO_EXPANSION = YES
-PREDEFINED = SERD_ALLOCATED \
- SERD_ALWAYS_INLINE_FUNC= \
- SERD_API \
+PREDEFINED = SERD_API \
SERD_CONST_API= \
- SERD_CONST_FUNC= \
SERD_MALLOC_API= \
- SERD_NONNULL= \
- SERD_NULLABLE= \
SERD_PURE_API= \
- SERD_PURE_FUNC= \
+ ZIX_ALLOCATED= \
+ ZIX_ALWAYS_INLINE_FUNC= \
+ ZIX_CONST_FUNC= \
+ ZIX_NONNULL= \
+ ZIX_NULLABLE= \
+ ZIX_PURE_FUNC=
RECURSIVE = YES
STRIP_FROM_PATH = @SERD_SRCDIR@
diff --git a/include/serd/attributes.h b/include/serd/attributes.h
index 59063153..4ea4d41d 100644
--- a/include/serd/attributes.h
+++ b/include/serd/attributes.h
@@ -4,6 +4,8 @@
#ifndef SERD_ATTRIBUTES_H
#define SERD_ATTRIBUTES_H
+#include "zix/attributes.h"
+
/**
@defgroup serd_attributes Attributes
@ingroup serd_library
@@ -43,41 +45,28 @@
// GCC function attributes
#ifdef __GNUC__
-# define SERD_ALWAYS_INLINE_FUNC __attribute__((always_inline))
-# define SERD_CONST_FUNC __attribute__((const))
-# define SERD_LOG_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
-# define SERD_MALLOC_FUNC __attribute__((malloc))
# define SERD_NODISCARD __attribute__((warn_unused_result))
-# define SERD_PURE_FUNC __attribute__((pure))
#else
-# define SERD_ALWAYS_INLINE_FUNC ///< Should absolutely always be inlined
-# define SERD_CONST_FUNC ///< Only reads its parameters
-# define SERD_LOG_FUNC(fmt, arg1) ///< Has printf-like parameters
-# define SERD_MALLOC_FUNC ///< Allocates memory
-# define SERD_NODISCARD ///< Returns a value that must be used
-# define SERD_PURE_FUNC ///< Only reads memory
+# define SERD_NODISCARD ///< Returns a value that must be used
#endif
-// Clang nullability annotations
-#if defined(__clang__) && __clang_major__ >= 7
-# define SERD_NONNULL _Nonnull
-# define SERD_NULLABLE _Nullable
-# define SERD_ALLOCATED _Null_unspecified
+// GCC print format attributes
+#if defined(__MINGW32__)
+# define SERD_LOG_FUNC(fmt, a0) __attribute__((format(gnu_printf, fmt, a0)))
+#elif defined(__GNUC__)
+# define SERD_LOG_FUNC(fmt, a0) __attribute__((format(printf, fmt, a0)))
#else
-# define SERD_NONNULL ///< A non-null pointer
-# define SERD_NULLABLE ///< A nullable pointer
-# define SERD_ALLOCATED ///< An allocated (possibly null) pointer
-# define SERD_UNSPECIFIED ///< A pointer with unspecified nullability
+# define SERD_LOG_FUNC(fmt, a0) ///< Has printf-like parameters
#endif
/// A pure function in the public API that only reads memory
-#define SERD_PURE_API SERD_API SERD_PURE_FUNC
+#define SERD_PURE_API SERD_API ZIX_PURE_FUNC
/// A const function in the public API that is pure and only reads parameters
-#define SERD_CONST_API SERD_API SERD_CONST_FUNC
+#define SERD_CONST_API SERD_API ZIX_CONST_FUNC
/// A malloc function in the public API that returns allocated memory
-#define SERD_MALLOC_API SERD_API SERD_MALLOC_FUNC
+#define SERD_MALLOC_API SERD_API ZIX_MALLOC_FUNC
/**
@}
diff --git a/include/serd/buffer.h b/include/serd/buffer.h
index f1bfa897..cf2170c3 100644
--- a/include/serd/buffer.h
+++ b/include/serd/buffer.h
@@ -5,6 +5,8 @@
#define SERD_BUFFER_H
#include "serd/attributes.h"
+#include "zix/allocator.h"
+#include "zix/attributes.h"
#include <stddef.h>
@@ -21,8 +23,8 @@ SERD_BEGIN_DECLS
/// A mutable buffer in memory
typedef struct {
- void* SERD_NULLABLE buf; ///< Buffer
- size_t len; ///< Size of buffer in bytes
+ void* ZIX_NULLABLE buf; ///< Buffer
+ size_t len; ///< Size of buffer in bytes
} SerdBuffer;
/**
@@ -34,10 +36,10 @@ typedef struct {
retrieved with serd_buffer_sink_finish().
*/
SERD_API size_t
-serd_buffer_sink(const void* SERD_NONNULL buf,
- size_t size,
- size_t nmemb,
- void* SERD_NONNULL stream);
+serd_buffer_sink(const void* ZIX_NONNULL buf,
+ size_t size,
+ size_t nmemb,
+ void* ZIX_NONNULL stream);
/**
Finish writing to a buffer with serd_buffer_sink().
@@ -45,8 +47,8 @@ serd_buffer_sink(const void* SERD_NONNULL buf,
The returned string is the result of the serialisation, which is null
terminated (by this function) and owned by the caller.
*/
-SERD_API char* SERD_NONNULL
-serd_buffer_sink_finish(SerdBuffer* SERD_NONNULL stream);
+SERD_API char* ZIX_NONNULL
+serd_buffer_sink_finish(SerdBuffer* ZIX_NONNULL stream);
/**
@}
diff --git a/include/serd/caret.h b/include/serd/caret.h
index 2ed77412..f8983899 100644
--- a/include/serd/caret.h
+++ b/include/serd/caret.h
@@ -6,6 +6,8 @@
#include "serd/attributes.h"
#include "serd/node.h"
+#include "zix/allocator.h"
+#include "zix/attributes.h"
#include <stdbool.h>
@@ -33,23 +35,23 @@ typedef struct SerdCaretImpl SerdCaret;
@param column The column number in the document (1-based)
@return A new caret that must be freed with serd_caret_free()
*/
-SERD_API SerdCaret* SERD_ALLOCATED
-serd_caret_new(const SerdNode* SERD_NONNULL document,
- unsigned line,
- unsigned column);
+SERD_API SerdCaret* ZIX_ALLOCATED
+serd_caret_new(const SerdNode* ZIX_NONNULL document,
+ unsigned line,
+ unsigned column);
/// Return a copy of `caret`
-SERD_API SerdCaret* SERD_ALLOCATED
-serd_caret_copy(const SerdCaret* SERD_NULLABLE caret);
+SERD_API SerdCaret* ZIX_ALLOCATED
+serd_caret_copy(const SerdCaret* ZIX_NULLABLE caret);
/// Free `caret`
SERD_API void
-serd_caret_free(SerdCaret* SERD_NULLABLE caret);
+serd_caret_free(SerdCaret* ZIX_NULLABLE caret);
/// Return true iff `lhs` is equal to `rhs`
SERD_PURE_API bool
-serd_caret_equals(const SerdCaret* SERD_NULLABLE lhs,
- const SerdCaret* SERD_NULLABLE rhs);
+serd_caret_equals(const SerdCaret* ZIX_NULLABLE lhs,
+ const SerdCaret* ZIX_NULLABLE rhs);
/**
Return the document URI or name.
@@ -57,16 +59,16 @@ serd_caret_equals(const SerdCaret* SERD_NULLABLE lhs,
This is typically a file URI, but may be a descriptive string node for
statements that originate from streams.
*/
-SERD_PURE_API const SerdNode* SERD_NONNULL
-serd_caret_document(const SerdCaret* SERD_NONNULL caret);
+SERD_PURE_API const SerdNode* ZIX_NONNULL
+serd_caret_document(const SerdCaret* ZIX_NONNULL caret);
/// Return the one-relative line number in the document
SERD_PURE_API unsigned
-serd_caret_line(const SerdCaret* SERD_NONNULL caret);
+serd_caret_line(const SerdCaret* ZIX_NONNULL caret);
/// Return the zero-relative column number in the line
SERD_PURE_API unsigned
-serd_caret_column(const SerdCaret* SERD_NONNULL caret);
+serd_caret_column(const SerdCaret* ZIX_NONNULL caret);
/**
@}
diff --git a/include/serd/env.h b/include/serd/env.h
index 404c96b6..bfbda520 100644
--- a/include/serd/env.h
+++ b/include/serd/env.h
@@ -9,6 +9,7 @@
#include "serd/sink.h"
#include "serd/status.h"
#include "serd/string_view.h"
+#include "zix/attributes.h"
#include <stdbool.h>
@@ -24,28 +25,28 @@ SERD_BEGIN_DECLS
typedef struct SerdEnvImpl SerdEnv;
/// Create a new environment
-SERD_API SerdEnv* SERD_ALLOCATED
+SERD_API SerdEnv* ZIX_ALLOCATED
serd_env_new(SerdStringView base_uri);
/// Copy an environment
-SERD_API SerdEnv* SERD_ALLOCATED
-serd_env_copy(const SerdEnv* SERD_NULLABLE env);
+SERD_API SerdEnv* ZIX_ALLOCATED
+serd_env_copy(const SerdEnv* ZIX_NULLABLE env);
/// Return true iff `a` is equal to `b`
SERD_PURE_API bool
-serd_env_equals(const SerdEnv* SERD_NULLABLE a, const SerdEnv* SERD_NULLABLE b);
+serd_env_equals(const SerdEnv* ZIX_NULLABLE a, const SerdEnv* ZIX_NULLABLE b);
/// Free `env`
SERD_API void
-serd_env_free(SerdEnv* SERD_NULLABLE env);
+serd_env_free(SerdEnv* ZIX_NULLABLE env);
/// Get the current base URI
-SERD_PURE_API const SerdNode* SERD_NULLABLE
-serd_env_base_uri(const SerdEnv* SERD_NULLABLE env);
+SERD_PURE_API const SerdNode* ZIX_NULLABLE
+serd_env_base_uri(const SerdEnv* ZIX_NULLABLE env);
/// Set the current base URI
SERD_API SerdStatus
-serd_env_set_base_uri(SerdEnv* SERD_NONNULL env, SerdStringView uri);
+serd_env_set_base_uri(SerdEnv* ZIX_NONNULL env, SerdStringView uri);
/**
Set a namespace prefix.
@@ -55,9 +56,9 @@ serd_env_set_base_uri(SerdEnv* SERD_NONNULL env, SerdStringView uri);
expand to "http://www.w3.org/2001/XMLSchema#decimal".
*/
SERD_API SerdStatus
-serd_env_set_prefix(SerdEnv* SERD_NONNULL env,
- SerdStringView name,
- SerdStringView uri);
+serd_env_set_prefix(SerdEnv* ZIX_NONNULL env,
+ SerdStringView name,
+ SerdStringView uri);
/**
Qualify `uri` into a CURIE if possible.
@@ -65,32 +66,32 @@ serd_env_set_prefix(SerdEnv* SERD_NONNULL env,
Returns null if `uri` can not be qualified (usually because no corresponding
prefix is defined).
*/
-SERD_API SerdNode* SERD_ALLOCATED
-serd_env_qualify(const SerdEnv* SERD_NULLABLE env,
- const SerdNode* SERD_NULLABLE uri);
+SERD_API SerdNode* ZIX_ALLOCATED
+serd_env_qualify(const SerdEnv* ZIX_NULLABLE env,
+ const SerdNode* ZIX_NULLABLE uri);
/**
Expand `node`, which must be a CURIE or URI, to a full URI.
Returns null if `node` can not be expanded.
*/
-SERD_API SerdNode* SERD_ALLOCATED
-serd_env_expand(const SerdEnv* SERD_NULLABLE env,
- const SerdNode* SERD_NULLABLE node);
+SERD_API SerdNode* ZIX_ALLOCATED
+serd_env_expand(const SerdEnv* ZIX_NULLABLE env,
+ const SerdNode* ZIX_NULLABLE node);
/**
Expand `node`, which must be a CURIE or URI, to a full URI.
Returns null if `node` can not be expanded.
*/
-SERD_API SerdNode* SERD_ALLOCATED
-serd_env_expand_node(const SerdEnv* SERD_NULLABLE env,
- const SerdNode* SERD_NONNULL node);
+SERD_API SerdNode* ZIX_ALLOCATED
+serd_env_expand_node(const SerdEnv* ZIX_NULLABLE env,
+ const SerdNode* ZIX_NONNULL node);
/// Write all prefixes in `env` to `sink`
SERD_API SerdStatus
-serd_env_write_prefixes(const SerdEnv* SERD_NONNULL env,
- const SerdSink* SERD_NONNULL sink);
+serd_env_write_prefixes(const SerdEnv* ZIX_NONNULL env,
+ const SerdSink* ZIX_NONNULL sink);
/**
@}
diff --git a/include/serd/error.h b/include/serd/error.h
index 7495ce3b..16b28e83 100644
--- a/include/serd/error.h
+++ b/include/serd/error.h
@@ -20,10 +20,10 @@ SERD_BEGIN_DECLS
/// An error description
typedef struct {
- SerdStatus status; ///< Error code
- const SerdCaret* SERD_NULLABLE caret; ///< File origin of error
- const char* SERD_NONNULL fmt; ///< Printf-style format string
- va_list* SERD_NONNULL args; ///< Arguments for fmt
+ SerdStatus status; ///< Error code
+ const SerdCaret* ZIX_NULLABLE caret; ///< File origin of error
+ const char* ZIX_NONNULL fmt; ///< Printf-style format string
+ va_list* ZIX_NONNULL args; ///< Arguments for fmt
} SerdError;
/**
@@ -32,8 +32,8 @@ typedef struct {
@param handle Handle for user data.
@param error Error description.
*/
-typedef SerdStatus (*SerdErrorFunc)(void* SERD_NULLABLE handle,
- const SerdError* SERD_NONNULL error);
+typedef SerdStatus (*SerdErrorFunc)(void* ZIX_NULLABLE handle,
+ const SerdError* ZIX_NONNULL error);
/**
@}
diff --git a/include/serd/event.h b/include/serd/event.h
index 0c6437f6..f5399366 100644
--- a/include/serd/event.h
+++ b/include/serd/event.h
@@ -8,6 +8,7 @@
#include "serd/node.h"
#include "serd/statement.h"
#include "serd/status.h"
+#include "zix/attributes.h"
SERD_BEGIN_DECLS
@@ -31,8 +32,8 @@ typedef enum {
Emitted whenever the base URI changes.
*/
typedef struct {
- SerdEventType type; ///< #SERD_BASE
- const SerdNode* SERD_NONNULL uri; ///< Base URI
+ SerdEventType type; ///< #SERD_BASE
+ const SerdNode* ZIX_NONNULL uri; ///< Base URI
} SerdBaseEvent;
/**
@@ -41,9 +42,9 @@ typedef struct {
Emitted whenever a prefix is defined.
*/
typedef struct {
- SerdEventType type; ///< #SERD_PREFIX
- const SerdNode* SERD_NONNULL name; ///< Prefix name
- const SerdNode* SERD_NONNULL uri; ///< Namespace URI
+ SerdEventType type; ///< #SERD_PREFIX
+ const SerdNode* ZIX_NONNULL name; ///< Prefix name
+ const SerdNode* ZIX_NONNULL uri; ///< Namespace URI
} SerdPrefixEvent;
/**
@@ -52,9 +53,9 @@ typedef struct {
Emitted for every statement.
*/
typedef struct {
- SerdEventType type; ///< #SERD_STATEMENT
- SerdStatementFlags flags; ///< Flags for pretty-printing
- const SerdStatement* SERD_NONNULL statement; ///< Statement
+ SerdEventType type; ///< #SERD_STATEMENT
+ SerdStatementFlags flags; ///< Flags for pretty-printing
+ const SerdStatement* ZIX_NONNULL statement; ///< Statement
} SerdStatementEvent;
/**
@@ -65,8 +66,8 @@ typedef struct {
write a delimiter.
*/
typedef struct {
- SerdEventType type; ///< #SERD_END
- const SerdNode* SERD_NONNULL node; ///< Anonymous node that is finished
+ SerdEventType type; ///< #SERD_END
+ const SerdNode* ZIX_NONNULL node; ///< Anonymous node that is finished
} SerdEndEvent;
/**
@@ -87,8 +88,8 @@ typedef union {
} SerdEvent;
/// Function for handling events
-typedef SerdStatus (*SerdEventFunc)(void* SERD_NULLABLE handle,
- const SerdEvent* SERD_NONNULL event);
+typedef SerdStatus (*SerdEventFunc)(void* ZIX_NULLABLE handle,
+ const SerdEvent* ZIX_NONNULL event);
/**
@}
diff --git a/include/serd/memory.h b/include/serd/memory.h
index 1bbd649c..0e50c4e3 100644
--- a/include/serd/memory.h
+++ b/include/serd/memory.h
@@ -22,7 +22,7 @@ SERD_BEGIN_DECLS
to the standard C free() function.
*/
SERD_API void
-serd_free(void* SERD_NULLABLE ptr);
+serd_free(void* ZIX_NULLABLE ptr);
/**
@}
diff --git a/include/serd/node.h b/include/serd/node.h
index 95638c68..98fb3d1a 100644
--- a/include/serd/node.h
+++ b/include/serd/node.h
@@ -8,6 +8,9 @@
#include "serd/string_view.h"
#include "serd/uri.h"
#include "serd/write_result.h"
+#include "zix/allocator.h"
+#include "zix/attributes.h"
+#include "zix/string_view.h"
#include <stdbool.h>
#include <stddef.h>
@@ -106,13 +109,13 @@ typedef uint32_t SerdNodeFlags;
A "token" is a node that isn't a typed or tagged literal. This can be used
to create URIs, blank nodes, CURIEs, and simple string literals.
*/
-SERD_API SerdNode* SERD_ALLOCATED
+SERD_API SerdNode* ZIX_ALLOCATED
serd_new_token(SerdNodeType type, SerdStringView string);
/**
Create a new string literal node.
*/
-SERD_API SerdNode* SERD_ALLOCATED
+SERD_API SerdNode* ZIX_ALLOCATED
serd_new_string(SerdStringView string);
/**
@@ -121,7 +124,7 @@ serd_new_string(SerdStringView string);
A plain literal has no datatype, but may have a language tag. The `lang`
may be empty, in which case this is equivalent to `serd_new_string()`.
*/
-SERD_API SerdNode* SERD_ALLOCATED
+SERD_API SerdNode* ZIX_ALLOCATED
serd_new_plain_literal(SerdStringView str, SerdStringView lang);
/**
@@ -131,29 +134,29 @@ serd_new_plain_literal(SerdStringView str, SerdStringView lang);
`datatype` may be NULL, in which case this is equivalent to
`serd_new_string()`.
*/
-SERD_API SerdNode* SERD_ALLOCATED
+SERD_API SerdNode* ZIX_ALLOCATED
serd_new_typed_literal(SerdStringView str, SerdStringView datatype_uri);
/**
Create a new node from a blank node label.
*/
-SERD_API SerdNode* SERD_ALLOCATED
+SERD_API SerdNode* ZIX_ALLOCATED
serd_new_blank(SerdStringView string);
/// Create a new CURIE node
-SERD_API SerdNode* SERD_ALLOCATED
+SERD_API SerdNode* ZIX_ALLOCATED
serd_new_curie(SerdStringView string);
/**
Create a new URI node from a parsed URI.
*/
-SERD_API SerdNode* SERD_ALLOCATED
+SERD_API SerdNode* ZIX_ALLOCATED
serd_new_parsed_uri(SerdURIView uri);
/**
Create a new URI node from a string.
*/
-SERD_API SerdNode* SERD_ALLOCATED
+SERD_API SerdNode* ZIX_ALLOCATED
serd_new_uri(SerdStringView string);
/**
@@ -164,13 +167,13 @@ serd_new_uri(SerdStringView string);
If `path` is relative, `hostname` is ignored.
*/
-SERD_API SerdNode* SERD_ALLOCATED
+SERD_API SerdNode* ZIX_ALLOCATED
serd_new_file_uri(SerdStringView path, SerdStringView hostname);
/**
Create a new canonical xsd:boolean node.
*/
-SERD_API SerdNode* SERD_ALLOCATED
+SERD_API SerdNode* ZIX_ALLOCATED
serd_new_boolean(bool b);
/**
@@ -186,8 +189,8 @@ serd_new_boolean(bool b);
@param d The value for the new node.
@param datatype Datatype of node, or NULL for xsd:decimal.
*/
-SERD_API SerdNode* SERD_ALLOCATED
-serd_new_decimal(double d, const SerdNode* SERD_NULLABLE datatype);
+SERD_API SerdNode* ZIX_ALLOCATED
+serd_new_decimal(double d, const SerdNode* ZIX_NULLABLE datatype);
/**
Create a new canonical xsd:double literal.
@@ -202,7 +205,7 @@ serd_new_decimal(double d, const SerdNode* SERD_NULLABLE datatype);
@param d Double value to write.
@return A literal node with datatype xsd:double.
*/
-SERD_API SerdNode* SERD_ALLOCATED
+SERD_API SerdNode* ZIX_ALLOCATED
serd_new_double(double d);
/**
@@ -214,7 +217,7 @@ serd_new_double(double d);
@param f Float value of literal.
@return A literal node with datatype xsd:float.
*/
-SERD_API SerdNode* SERD_ALLOCATED
+SERD_API SerdNode* ZIX_ALLOCATED
serd_new_float(float f);
/**
@@ -226,8 +229,8 @@ serd_new_float(float f);
@param i Integer value of literal.
@param datatype Datatype of node, or NULL for xsd:integer.
*/
-SERD_API SerdNode* SERD_ALLOCATED
-serd_new_integer(int64_t i, const SerdNode* SERD_NULLABLE datatype);
+SERD_API SerdNode* ZIX_ALLOCATED
+serd_new_integer(int64_t i, const SerdNode* ZIX_NULLABLE datatype);
/**
Create a new canonical xsd:base64Binary literal.
@@ -239,20 +242,20 @@ serd_new_integer(int64_t i, const SerdNode* SERD_NULLABLE datatype);
@param size Size of `buf` in bytes.
@param datatype Datatype of node, or null for xsd:base64Binary.
*/
-SERD_API SerdNode* SERD_ALLOCATED
-serd_new_base64(const void* SERD_NONNULL buf,
- size_t size,
- const SerdNode* SERD_NULLABLE datatype);
+SERD_API SerdNode* ZIX_ALLOCATED
+serd_new_base64(const void* ZIX_NONNULL buf,
+ size_t size,
+ const SerdNode* ZIX_NULLABLE datatype);
/// Return a deep copy of `node`
-SERD_API SerdNode* SERD_ALLOCATED
-serd_node_copy(const SerdNode* SERD_NULLABLE node);
+SERD_API SerdNode* ZIX_ALLOCATED
+serd_node_copy(const SerdNode* ZIX_NULLABLE node);
/**
Free any data owned by `node`.
*/
SERD_API void
-serd_node_free(SerdNode* SERD_NULLABLE node);
+serd_node_free(SerdNode* ZIX_NULLABLE node);
/**
@}
@@ -262,19 +265,19 @@ serd_node_free(SerdNode* SERD_NULLABLE node);
/// Return the type of a node
SERD_PURE_API SerdNodeType
-serd_node_type(const SerdNode* SERD_NONNULL node);
+serd_node_type(const SerdNode* ZIX_NONNULL node);
/// Return the length of a node's string in bytes, excluding the terminator
SERD_PURE_API size_t
-serd_node_length(const SerdNode* SERD_NULLABLE node);
+serd_node_length(const SerdNode* ZIX_NULLABLE node);
/// Return the additional flags of a node
SERD_PURE_API SerdNodeFlags
-serd_node_flags(const SerdNode* SERD_NONNULL node);
+serd_node_flags(const SerdNode* ZIX_NONNULL node);
/// Return the string contents of a node
-SERD_CONST_API const char* SERD_NONNULL
-serd_node_string(const SerdNode* SERD_NONNULL node);
+SERD_CONST_API const char* ZIX_NONNULL
+serd_node_string(const SerdNode* ZIX_NONNULL node);
/**
Return a view of the string in a node.
@@ -283,7 +286,7 @@ serd_node_string(const SerdNode* SERD_NONNULL node);
that can be used to get both in a single call.
*/
SERD_PURE_API SerdStringView
-serd_node_string_view(const SerdNode* SERD_NONNULL node);
+serd_node_string_view(const SerdNode* ZIX_NONNULL node);
/**
Return a parsed view of the URI in a node.
@@ -297,7 +300,7 @@ serd_node_string_view(const SerdNode* SERD_NONNULL node);
scope.
*/
SERD_PURE_API SerdURIView
-serd_node_uri_view(const SerdNode* SERD_NONNULL node);
+serd_node_uri_view(const SerdNode* ZIX_NONNULL node);
/**
Return the optional datatype of a literal node.
@@ -305,8 +308,8 @@ serd_node_uri_view(const SerdNode* SERD_NONNULL node);
The datatype, if present, is always a URI, typically something like
<http://www.w3.org/2001/XMLSchema#boolean>.
*/
-SERD_PURE_API const SerdNode* SERD_NULLABLE
-serd_node_datatype(const SerdNode* SERD_NONNULL node);
+SERD_PURE_API const SerdNode* ZIX_NULLABLE
+serd_node_datatype(const SerdNode* ZIX_NONNULL node);
/**
Return the optional language tag of a literal node.
@@ -316,8 +319,8 @@ serd_node_datatype(const SerdNode* SERD_NONNULL node);
example, the common form "en-CA" is valid, but lowercase is considered
canonical here.
*/
-SERD_PURE_API const SerdNode* SERD_NULLABLE
-serd_node_language(const SerdNode* SERD_NONNULL node);
+SERD_PURE_API const SerdNode* ZIX_NULLABLE
+serd_node_language(const SerdNode* ZIX_NONNULL node);
/**
Return the value of `node` as a boolean.
@@ -328,7 +331,7 @@ serd_node_language(const SerdNode* SERD_NONNULL node);
@return The value of `node` as a `bool`, or `false` on error.
*/
SERD_API bool
-serd_get_boolean(const SerdNode* SERD_NONNULL node);
+serd_get_boolean(const SerdNode* ZIX_NONNULL node);
/**
Return the value of `node` as a double.
@@ -338,7 +341,7 @@ serd_get_boolean(const SerdNode* SERD_NONNULL node);
@return The value of `node` as a `double`, or NaN on error.
*/
SERD_API double
-serd_get_double(const SerdNode* SERD_NONNULL node);
+serd_get_double(const SerdNode* ZIX_NONNULL node);
/**
Return the value of `node` as a float.
@@ -348,7 +351,7 @@ serd_get_double(const SerdNode* SERD_NONNULL node);
@return The value of `node` as a `float`, or NaN on error.
*/
SERD_API float
-serd_get_float(const SerdNode* SERD_NONNULL node);
+serd_get_float(const SerdNode* ZIX_NONNULL node);
/**
Return the value of `node` as a long (signed 64-bit integer).
@@ -358,7 +361,7 @@ serd_get_float(const SerdNode* SERD_NONNULL node);
@return The value of `node` as a `int64_t`, or 0 on error.
*/
SERD_API int64_t
-serd_get_integer(const SerdNode* SERD_NONNULL node);
+serd_get_integer(const SerdNode* ZIX_NONNULL node);
/**
Return the maximum size of a decoded binary node in bytes.
@@ -369,7 +372,7 @@ serd_get_integer(const SerdNode* SERD_NONNULL node);
the actual size of the data due to things like additional whitespace.
*/
SERD_PURE_API size_t
-serd_get_base64_size(const SerdNode* SERD_NONNULL node);
+serd_get_base64_size(const SerdNode* ZIX_NONNULL node);
/**
Decode a base64 node.
@@ -387,9 +390,9 @@ serd_get_base64_size(const SerdNode* SERD_NONNULL node);
along with the number of bytes required for successful decoding.
*/
SERD_API SerdWriteResult
-serd_get_base64(const SerdNode* SERD_NONNULL node,
- size_t buf_size,
- void* SERD_NONNULL buf);
+serd_get_base64(const SerdNode* ZIX_NONNULL node,
+ size_t buf_size,
+ void* ZIX_NONNULL buf);
/**
@}
@@ -406,8 +409,8 @@ serd_get_base64(const SerdNode* SERD_NONNULL node,
@return True if `a` and `b` point to equal nodes, or are both null.
*/
SERD_PURE_API bool
-serd_node_equals(const SerdNode* SERD_NULLABLE a,
- const SerdNode* SERD_NULLABLE b);
+serd_node_equals(const SerdNode* ZIX_NULLABLE a,
+ const SerdNode* ZIX_NULLABLE b);
/**
Compare two nodes.
@@ -419,8 +422,7 @@ serd_node_equals(const SerdNode* SERD_NULLABLE a,
datatype, if present.
*/
SERD_PURE_API int
-serd_node_compare(const SerdNode* SERD_NONNULL a,
- const SerdNode* SERD_NONNULL b);
+serd_node_compare(const SerdNode* ZIX_NONNULL a, const SerdNode* ZIX_NONNULL b);
/**
@}
diff --git a/include/serd/reader.h b/include/serd/reader.h
index 5df1acc9..c79d6a44 100644
--- a/include/serd/reader.h
+++ b/include/serd/reader.h
@@ -11,6 +11,7 @@
#include "serd/stream.h"
#include "serd/syntax.h"
#include "serd/world.h"
+#include "zix/attributes.h"
#include <stdbool.h>
#include <stddef.h>
@@ -36,11 +37,11 @@ typedef enum {
typedef uint32_t SerdReaderFlags;
/// Create a new RDF reader
-SERD_API SerdReader* SERD_ALLOCATED
-serd_reader_new(SerdWorld* SERD_NONNULL world,
- SerdSyntax syntax,
- SerdReaderFlags flags,
- const SerdSink* SERD_NONNULL sink);
+SERD_API SerdReader* ZIX_ALLOCATED
+serd_reader_new(SerdWorld* ZIX_NONNULL world,
+ SerdSyntax syntax,
+ SerdReaderFlags flags,
+ const SerdSink* ZIX_NONNULL sink);
/**
Set a prefix to be added to all blank node identifiers.
@@ -52,14 +53,14 @@ serd_reader_new(SerdWorld* SERD_NONNULL world,
this can be avoided, while preserving blank node names.
*/
SERD_API void
-serd_reader_add_blank_prefix(SerdReader* SERD_NONNULL reader,
- const char* SERD_NULLABLE prefix);
+serd_reader_add_blank_prefix(SerdReader* ZIX_NONNULL reader,
+ const char* ZIX_NULLABLE prefix);
/// Prepare to read from the file at a local file `uri`
SERD_API SerdStatus
-serd_reader_start_file(SerdReader* SERD_NONNULL reader,
- const char* SERD_NONNULL uri,
- bool bulk);
+serd_reader_start_file(SerdReader* ZIX_NONNULL reader,
+ const char* ZIX_NONNULL uri,
+ bool bulk);
/**
Prepare to read from a stream.
@@ -68,18 +69,18 @@ serd_reader_start_file(SerdReader* SERD_NONNULL reader,
with size 1 (i.e. `page_size` bytes).
*/
SERD_API SerdStatus
-serd_reader_start_stream(SerdReader* SERD_NONNULL reader,
- SerdReadFunc SERD_NONNULL read_func,
- SerdStreamErrorFunc SERD_NONNULL error_func,
- void* SERD_NONNULL stream,
- const SerdNode* SERD_NULLABLE name,
- size_t page_size);
+serd_reader_start_stream(SerdReader* ZIX_NONNULL reader,
+ SerdReadFunc ZIX_NONNULL read_func,
+ SerdStreamErrorFunc ZIX_NONNULL error_func,
+ void* ZIX_NONNULL stream,
+ const SerdNode* ZIX_NULLABLE name,
+ size_t page_size);
/// Prepare to read from a string
SERD_API SerdStatus
-serd_reader_start_string(SerdReader* SERD_NONNULL reader,
- const char* SERD_NONNULL utf8,
- const SerdNode* SERD_NULLABLE name);
+serd_reader_start_string(SerdReader* ZIX_NONNULL reader,
+ const char* ZIX_NONNULL utf8,
+ const SerdNode* ZIX_NULLABLE name);
/**
Read a single "chunk" of data during an incremental read.
@@ -90,7 +91,7 @@ serd_reader_start_string(SerdReader* SERD_NONNULL reader,
directly from a pipe or socket.
*/
SERD_API SerdStatus
-serd_reader_read_chunk(SerdReader* SERD_NONNULL reader);
+serd_reader_read_chunk(SerdReader* ZIX_NONNULL reader);
/**
Read a complete document from the source.
@@ -100,7 +101,7 @@ serd_reader_read_chunk(SerdReader* SERD_NONNULL reader);
for incremental reading use serd_reader_read_chunk().
*/
SERD_API SerdStatus
-serd_reader_read_document(SerdReader* SERD_NONNULL reader);
+serd_reader_read_document(SerdReader* ZIX_NONNULL reader);
/**
Finish reading from the source.
@@ -108,7 +109,7 @@ serd_reader_read_document(SerdReader* SERD_NONNULL reader);
This should be called before starting to read from another source.
*/
SERD_API SerdStatus
-serd_reader_finish(SerdReader* SERD_NONNULL reader);
+serd_reader_finish(SerdReader* ZIX_NONNULL reader);
/**
Skip over bytes in the input until a specific byte is encountered.
@@ -120,7 +121,7 @@ serd_reader_finish(SerdReader* SERD_NONNULL reader);
end of input is reached.
*/
SERD_API SerdStatus
-serd_reader_skip_until_byte(SerdReader* SERD_NONNULL reader, uint8_t byte);
+serd_reader_skip_until_byte(SerdReader* ZIX_NONNULL reader, uint8_t byte);
/**
Free `reader`.
@@ -128,7 +129,7 @@ serd_reader_skip_until_byte(SerdReader* SERD_NONNULL reader, uint8_t byte);
The reader will be finished via `serd_reader_finish()` if necessary.
*/
SERD_API void
-serd_reader_free(SerdReader* SERD_NULLABLE reader);
+serd_reader_free(SerdReader* ZIX_NULLABLE reader);
/**
@}
diff --git a/include/serd/sink.h b/include/serd/sink.h
index 09fa7858..58932435 100644
--- a/include/serd/sink.h
+++ b/include/serd/sink.h
@@ -9,6 +9,8 @@
#include "serd/node.h"
#include "serd/statement.h"
#include "serd/status.h"
+#include "zix/allocator.h"
+#include "zix/attributes.h"
SERD_BEGIN_DECLS
@@ -23,26 +25,26 @@ SERD_BEGIN_DECLS
Called whenever the base URI of the serialisation changes.
*/
-typedef SerdStatus (*SerdBaseFunc)(void* SERD_NULLABLE handle,
- const SerdNode* SERD_NONNULL uri);
+typedef SerdStatus (*SerdBaseFunc)(void* ZIX_NULLABLE handle,
+ const SerdNode* ZIX_NONNULL uri);
/**
Sink function for namespace definitions.
Called whenever a prefix is defined in the serialisation.
*/
-typedef SerdStatus (*SerdPrefixFunc)(void* SERD_NULLABLE handle,
- const SerdNode* SERD_NONNULL name,
- const SerdNode* SERD_NONNULL uri);
+typedef SerdStatus (*SerdPrefixFunc)(void* ZIX_NULLABLE handle,
+ const SerdNode* ZIX_NONNULL name,
+ const SerdNode* ZIX_NONNULL uri);
/**
Sink function for statements.
Called for every RDF statement in the serialisation.
*/
-typedef SerdStatus (*SerdStatementFunc)(void* SERD_NULLABLE handle,
- SerdStatementFlags flags,
- const SerdStatement* SERD_NONNULL
+typedef SerdStatus (*SerdStatementFunc)(void* ZIX_NULLABLE handle,
+ SerdStatementFlags flags,
+ const SerdStatement* ZIX_NONNULL
statement);
/**
@@ -52,14 +54,14 @@ typedef SerdStatus (*SerdStatementFunc)(void* SERD_NULLABLE handle,
will no longer be referred to by any future statements (so the anonymous
node is finished).
*/
-typedef SerdStatus (*SerdEndFunc)(void* SERD_NULLABLE handle,
- const SerdNode* SERD_NONNULL node);
+typedef SerdStatus (*SerdEndFunc)(void* ZIX_NULLABLE handle,
+ const SerdNode* ZIX_NONNULL node);
/// An interface that receives a stream of RDF data
typedef struct SerdSinkImpl SerdSink;
/// Function to free an opaque handle
-typedef void (*SerdFreeFunc)(void* SERD_NULLABLE ptr);
+typedef void (*SerdFreeFunc)(void* ZIX_NULLABLE ptr);
/**
Create a new sink.
@@ -68,50 +70,50 @@ typedef void (*SerdFreeFunc)(void* SERD_NULLABLE ptr);
@param event_func Function that will be called for every event.
@param free_handle Free function to call on handle in serd_sink_free().
*/
-SERD_API SerdSink* SERD_ALLOCATED
-serd_sink_new(void* SERD_NULLABLE handle,
- SerdEventFunc SERD_NULLABLE event_func,
- SerdFreeFunc SERD_NULLABLE free_handle);
+SERD_API SerdSink* ZIX_ALLOCATED
+serd_sink_new(void* ZIX_NULLABLE handle,
+ SerdEventFunc ZIX_NULLABLE event_func,
+ SerdFreeFunc ZIX_NULLABLE free_handle);
/// Free `sink`
SERD_API void
-serd_sink_free(SerdSink* SERD_NULLABLE sink);
+serd_sink_free(SerdSink* ZIX_NULLABLE sink);
/// Send an event to the sink
SERD_API SerdStatus
-serd_sink_write_event(const SerdSink* SERD_NONNULL sink,
- const SerdEvent* SERD_NONNULL event);
+serd_sink_write_event(const SerdSink* ZIX_NONNULL sink,
+ const SerdEvent* ZIX_NONNULL event);
/// Set the base URI
SERD_API SerdStatus
-serd_sink_write_base(const SerdSink* SERD_NONNULL sink,
- const SerdNode* SERD_NONNULL uri);
+serd_sink_write_base(const SerdSink* ZIX_NONNULL sink,
+ const SerdNode* ZIX_NONNULL uri);
/// Set a namespace prefix
SERD_API SerdStatus
-serd_sink_write_prefix(const SerdSink* SERD_NONNULL sink,
- const SerdNode* SERD_NONNULL name,
- const SerdNode* SERD_NONNULL uri);
+serd_sink_write_prefix(const SerdSink* ZIX_NONNULL sink,
+ const SerdNode* ZIX_NONNULL name,
+ const SerdNode* ZIX_NONNULL uri);
/// Write a statement
SERD_API SerdStatus
-serd_sink_write_statement(const SerdSink* SERD_NONNULL sink,
- SerdStatementFlags flags,
- const SerdStatement* SERD_NONNULL statement);
+serd_sink_write_statement(const SerdSink* ZIX_NONNULL sink,
+ SerdStatementFlags flags,
+ const SerdStatement* ZIX_NONNULL statement);
/// Write a statement from individual nodes
SERD_API SerdStatus
-serd_sink_write(const SerdSink* SERD_NONNULL sink,
- SerdStatementFlags flags,
- const SerdNode* SERD_NONNULL subject,
- const SerdNode* SERD_NONNULL predicate,
- const SerdNode* SERD_NONNULL object,
- const SerdNode* SERD_NULLABLE graph);
+serd_sink_write(const SerdSink* ZIX_NONNULL sink,
+ SerdStatementFlags flags,
+ const SerdNode* ZIX_NONNULL subject,
+ const SerdNode* ZIX_NONNULL predicate,
+ const SerdNode* ZIX_NONNULL object,
+ const SerdNode* ZIX_NULLABLE graph);
/// Mark the end of an anonymous node
SERD_API SerdStatus
-serd_sink_write_end(const SerdSink* SERD_NONNULL sink,
- const SerdNode* SERD_NONNULL node);
+serd_sink_write_end(const SerdSink* ZIX_NONNULL sink,
+ const SerdNode* ZIX_NONNULL node);
/**
@}
diff --git a/include/serd/statement.h b/include/serd/statement.h
index a1932796..2e8eddc2 100644
--- a/include/serd/statement.h
+++ b/include/serd/statement.h
@@ -7,6 +7,8 @@
#include "serd/attributes.h"
#include "serd/caret.h"
#include "serd/node.h"
+#include "zix/allocator.h"
+#include "zix/attributes.h"
#include <stdbool.h>
#include <stdint.h>
@@ -60,45 +62,45 @@ typedef struct SerdStatementImpl SerdStatement;
@param caret Optional caret at the origin of this statement
@return A new statement that must be freed with serd_statement_free()
*/
-SERD_API SerdStatement* SERD_ALLOCATED
-serd_statement_new(const SerdNode* SERD_NONNULL s,
- const SerdNode* SERD_NONNULL p,
- const SerdNode* SERD_NONNULL o,
- const SerdNode* SERD_NULLABLE g,
- const SerdCaret* SERD_NULLABLE caret);
+SERD_API SerdStatement* ZIX_ALLOCATED
+serd_statement_new(const SerdNode* ZIX_NONNULL s,
+ const SerdNode* ZIX_NONNULL p,
+ const SerdNode* ZIX_NONNULL o,
+ const SerdNode* ZIX_NULLABLE g,
+ const SerdCaret* ZIX_NULLABLE caret);
/// Return a copy of `statement`
-SERD_API SerdStatement* SERD_ALLOCATED
-serd_statement_copy(const SerdStatement* SERD_NULLABLE statement);
+SERD_API SerdStatement* ZIX_ALLOCATED
+serd_statement_copy(const SerdStatement* ZIX_NULLABLE statement);
/// Free `statement`
SERD_API void
-serd_statement_free(SerdStatement* SERD_NULLABLE statement);
+serd_statement_free(SerdStatement* ZIX_NULLABLE statement);
/// Return the given node of the statement
-SERD_PURE_API const SerdNode* SERD_NULLABLE
-serd_statement_node(const SerdStatement* SERD_NONNULL statement,
- SerdField field);
+SERD_PURE_API const SerdNode* ZIX_NULLABLE
+serd_statement_node(const SerdStatement* ZIX_NONNULL statement,
+ SerdField field);
/// Return the subject of the statement
-SERD_PURE_API const SerdNode* SERD_NONNULL
-serd_statement_subject(const SerdStatement* SERD_NONNULL statement);
+SERD_PURE_API const SerdNode* ZIX_NONNULL
+serd_statement_subject(const SerdStatement* ZIX_NONNULL statement);
/// Return the predicate of the statement
-SERD_PURE_API const SerdNode* SERD_NONNULL
-serd_statement_predicate(const SerdStatement* SERD_NONNULL statement);
+SERD_PURE_API const SerdNode* ZIX_NONNULL
+serd_statement_predicate(const SerdStatement* ZIX_NONNULL statement);
/// Return the object of the statement
-SERD_PURE_API const SerdNode* SERD_NONNULL
-serd_statement_object(const SerdStatement* SERD_NONNULL statement);
+SERD_PURE_API const SerdNode* ZIX_NONNULL
+serd_statement_object(const SerdStatement* ZIX_NONNULL statement);
/// Return the graph of the statement
-SERD_PURE_API const SerdNode* SERD_NULLABLE
-serd_statement_graph(const SerdStatement* SERD_NONNULL statement);
+SERD_PURE_API const SerdNode* ZIX_NULLABLE
+serd_statement_graph(const SerdStatement* ZIX_NONNULL statement);
/// Return the source location where the statement originated, or NULL
-SERD_PURE_API const SerdCaret* SERD_NULLABLE
-serd_statement_caret(const SerdStatement* SERD_NONNULL statement);
+SERD_PURE_API const SerdCaret* ZIX_NULLABLE
+serd_statement_caret(const SerdStatement* ZIX_NONNULL statement);
/**
Return true iff `a` is equal to `b`, ignoring statement caret metadata.
@@ -107,8 +109,8 @@ serd_statement_caret(const SerdStatement* SERD_NONNULL statement);
matching.
*/
SERD_PURE_API bool
-serd_statement_equals(const SerdStatement* SERD_NULLABLE a,
- const SerdStatement* SERD_NULLABLE b);
+serd_statement_equals(const SerdStatement* ZIX_NULLABLE a,
+ const SerdStatement* ZIX_NULLABLE b);
/**
Return true iff the statement matches the given pattern.
@@ -117,11 +119,12 @@ serd_statement_equals(const SerdStatement* SERD_NULLABLE a,
statement matches if every node matches.
*/
SERD_PURE_API bool
-serd_statement_matches(const SerdStatement* SERD_NONNULL statement,
- const SerdNode* SERD_NULLABLE subject,
- const SerdNode* SERD_NULLABLE predicate,
- const SerdNode* SERD_NULLABLE object,
- const SerdNode* SERD_NULLABLE graph);
+serd_statement_matches(const SerdStatement* ZIX_NONNULL statement,
+ const SerdNode* ZIX_NULLABLE subject,
+ const SerdNode* ZIX_NULLABLE predicate,
+ const SerdNode* ZIX_NULLABLE object,
+ const SerdNode* ZIX_NULLABLE graph);
+
/**
@}
*/
diff --git a/include/serd/status.h b/include/serd/status.h
index e21297cd..c6047aff 100644
--- a/include/serd/status.h
+++ b/include/serd/status.h
@@ -5,6 +5,7 @@
#define SERD_STATUS_H
#include "serd/attributes.h"
+#include "zix/attributes.h"
SERD_BEGIN_DECLS
@@ -41,7 +42,7 @@ typedef enum {
} SerdStatus;
/// Return a string describing a status code
-SERD_CONST_API const char* SERD_NONNULL
+SERD_CONST_API const char* ZIX_NONNULL
serd_strerror(SerdStatus status);
/**
diff --git a/include/serd/stream.h b/include/serd/stream.h
index 992db552..4b3582f5 100644
--- a/include/serd/stream.h
+++ b/include/serd/stream.h
@@ -5,6 +5,7 @@
#define SERD_STREAM_H
#include "serd/attributes.h"
+#include "zix/attributes.h"
#include <stddef.h>
@@ -29,7 +30,7 @@ SERD_BEGIN_DECLS
@return Non-zero if `stream` has encountered an error.
*/
-typedef int (*SerdStreamErrorFunc)(void* SERD_NONNULL stream);
+typedef int (*SerdStreamErrorFunc)(void* ZIX_NONNULL stream);
/**
Function for reading input bytes from a stream.
@@ -43,10 +44,10 @@ typedef int (*SerdStreamErrorFunc)(void* SERD_NONNULL stream);
@param stream Stream to read from (FILE* for fread).
@return Number of elements (bytes) read, which is short on error.
*/
-typedef size_t (*SerdReadFunc)(void* SERD_NONNULL buf,
- size_t size,
- size_t nmemb,
- void* SERD_NONNULL stream);
+typedef size_t (*SerdReadFunc)(void* ZIX_NONNULL buf,
+ size_t size,
+ size_t nmemb,
+ void* ZIX_NONNULL stream);
/**
Function for writing output bytes to a stream.
@@ -60,10 +61,10 @@ typedef size_t (*SerdReadFunc)(void* SERD_NONNULL buf,
@param stream Stream to write to (FILE* for fread).
@return Number of elements (bytes) written, which is short on error.
*/
-typedef size_t (*SerdWriteFunc)(const void* SERD_NONNULL buf,
- size_t size,
- size_t nmemb,
- void* SERD_NONNULL stream);
+typedef size_t (*SerdWriteFunc)(const void* ZIX_NONNULL buf,
+ size_t size,
+ size_t nmemb,
+ void* ZIX_NONNULL stream);
/**
@}
diff --git a/include/serd/string.h b/include/serd/string.h
index f0b8e591..46da939d 100644
--- a/include/serd/string.h
+++ b/include/serd/string.h
@@ -6,6 +6,7 @@
#include "serd/attributes.h"
#include "serd/node.h"
+#include "zix/attributes.h"
#include <stddef.h>
@@ -25,7 +26,7 @@ SERD_BEGIN_DECLS
@param flags (Output) Set to the applicable flags.
*/
SERD_API size_t
-serd_strlen(const char* SERD_NONNULL str, SerdNodeFlags* SERD_NULLABLE flags);
+serd_strlen(const char* ZIX_NONNULL str, SerdNodeFlags* ZIX_NULLABLE flags);
/**
Decode a base64 string.
@@ -37,10 +38,10 @@ serd_strlen(const char* SERD_NONNULL str, SerdNodeFlags* SERD_NULLABLE flags);
@param size Set to the size of the returned blob in bytes.
@return A newly allocated blob which must be freed with serd_free().
*/
-SERD_API void* SERD_ALLOCATED
-serd_base64_decode(const char* SERD_NONNULL str,
- size_t len,
- size_t* SERD_NONNULL size);
+SERD_API void* ZIX_ALLOCATED
+serd_base64_decode(const char* ZIX_NONNULL str,
+ size_t len,
+ size_t* ZIX_NONNULL size);
/**
@}
diff --git a/include/serd/string_view.h b/include/serd/string_view.h
index cab25081..07b6dd69 100644
--- a/include/serd/string_view.h
+++ b/include/serd/string_view.h
@@ -24,12 +24,12 @@ SERD_BEGIN_DECLS
of strings in-place and to avoid redundant string measurement.
*/
typedef struct {
- const char* SERD_NONNULL data; ///< Start of string
- size_t length; ///< Length of string in bytes
+ const char* ZIX_NONNULL data; ///< Start of string
+ size_t length; ///< Length of string in bytes
} SerdStringView;
/// Return a view of an empty string
-SERD_ALWAYS_INLINE_FUNC SERD_CONST_FUNC static inline SerdStringView
+ZIX_ALWAYS_INLINE_FUNC ZIX_CONST_FUNC static inline SerdStringView
serd_empty_string(void)
{
const SerdStringView view = {"", 0U};
@@ -49,8 +49,8 @@ serd_empty_string(void)
@param len Length of the substring in bytes, not including the trailing null
terminator if present.
*/
-SERD_ALWAYS_INLINE_FUNC SERD_CONST_FUNC static inline SerdStringView
-serd_substring(const char* const SERD_NONNULL str, const size_t len)
+ZIX_ALWAYS_INLINE_FUNC ZIX_CONST_FUNC static inline SerdStringView
+serd_substring(const char* const ZIX_NONNULL str, const size_t len)
{
const SerdStringView view = {str, len};
return view;
@@ -63,9 +63,9 @@ serd_substring(const char* const SERD_NONNULL str, const size_t len)
@param str Pointer to the start of a null-terminated C string, or null.
*/
-SERD_ALWAYS_INLINE_FUNC SERD_PURE_FUNC static inline SerdStringView
+ZIX_ALWAYS_INLINE_FUNC ZIX_PURE_FUNC static inline SerdStringView
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
-serd_string(const char* const SERD_NULLABLE str)
+serd_string(const char* const ZIX_NULLABLE str)
{
return str ? serd_substring(str, strlen(str)) : serd_empty_string();
}
diff --git a/include/serd/syntax.h b/include/serd/syntax.h
index 62ba6571..c5ec19b3 100644
--- a/include/serd/syntax.h
+++ b/include/serd/syntax.h
@@ -5,6 +5,7 @@
#define SERD_SYNTAX_H
#include "serd/attributes.h"
+#include "zix/attributes.h"
#include <stdbool.h>
@@ -34,7 +35,7 @@ typedef enum {
unknown.
*/
SERD_PURE_API SerdSyntax
-serd_syntax_by_name(const char* SERD_NONNULL name);
+serd_syntax_by_name(const char* ZIX_NONNULL name);
/**
Guess a syntax from a filename.
@@ -43,7 +44,7 @@ serd_syntax_by_name(const char* SERD_NONNULL name);
returned if the extension is not recognized.
*/
SERD_PURE_API SerdSyntax
-serd_guess_syntax(const char* SERD_NONNULL filename);
+serd_guess_syntax(const char* ZIX_NONNULL filename);
/**
Return whether a syntax can represent multiple graphs in one document.
diff --git a/include/serd/uri.h b/include/serd/uri.h
index 3170fa89..bee9fe78 100644
--- a/include/serd/uri.h
+++ b/include/serd/uri.h
@@ -7,6 +7,9 @@
#include "serd/attributes.h"
#include "serd/stream.h"
#include "serd/string_view.h"
+#include "zix/allocator.h"
+#include "zix/attributes.h"
+#include "zix/string_view.h"
#include <stdbool.h>
#include <stddef.h>
@@ -58,17 +61,17 @@ static const SerdURIView SERD_URI_NULL =
@param hostname If non-NULL, set to the hostname, if present.
@return A newly-allocated filesystem path.
*/
-SERD_API char* SERD_ALLOCATED
-serd_parse_file_uri(const char* SERD_NONNULL uri,
- char* SERD_NONNULL* SERD_NULLABLE hostname);
+SERD_API char* ZIX_ALLOCATED
+serd_parse_file_uri(const char* ZIX_NONNULL uri,
+ char* ZIX_NONNULL* ZIX_NULLABLE hostname);
/// Return true iff `string` starts with a valid URI scheme
SERD_PURE_API bool
-serd_uri_string_has_scheme(const char* SERD_NONNULL string);
+serd_uri_string_has_scheme(const char* ZIX_NONNULL string);
/// Parse `string` and return a URI view that points into it
SERD_PURE_API SerdURIView
-serd_parse_uri(const char* SERD_NONNULL string);
+serd_parse_uri(const char* ZIX_NONNULL string);
/**
Return reference `r` resolved against `base`.
@@ -146,9 +149,9 @@ serd_uri_string_length(SerdURIView uri);
`serd_uri_string_length(uri)` on error.
*/
SERD_API size_t
-serd_write_uri(SerdURIView uri,
- SerdWriteFunc SERD_NONNULL sink,
- void* SERD_NONNULL stream);
+serd_write_uri(SerdURIView uri,
+ SerdWriteFunc ZIX_NONNULL sink,
+ void* ZIX_NONNULL stream);
/**
@}
diff --git a/include/serd/world.h b/include/serd/world.h
index b4849fa2..4c51df73 100644
--- a/include/serd/world.h
+++ b/include/serd/world.h
@@ -8,6 +8,8 @@
#include "serd/error.h"
#include "serd/node.h"
#include "serd/status.h"
+#include "zix/allocator.h"
+#include "zix/attributes.h"
#include <stddef.h>
@@ -34,12 +36,12 @@ typedef struct {
It is safe to use multiple worlds in one process, though no objects can be
shared between worlds.
*/
-SERD_MALLOC_API SerdWorld* SERD_ALLOCATED
+SERD_MALLOC_API SerdWorld* ZIX_ALLOCATED
serd_world_new(void);
/// Free `world`
SERD_API void
-serd_world_free(SerdWorld* SERD_NULLABLE world);
+serd_world_free(SerdWorld* ZIX_NULLABLE world);
/**
Return the current resource limits.
@@ -50,7 +52,7 @@ serd_world_free(SerdWorld* SERD_NULLABLE world);
most data.
*/
SERD_API SerdLimits
-serd_world_limits(const SerdWorld* SERD_NONNULL world);
+serd_world_limits(const SerdWorld* ZIX_NONNULL world);
/**
Set the current resource limits.
@@ -60,7 +62,7 @@ serd_world_limits(const SerdWorld* SERD_NONNULL world);
other function like serd_reader_new() that uses the current limits.
*/
SERD_API SerdStatus
-serd_world_set_limits(SerdWorld* SERD_NONNULL world, SerdLimits limits);
+serd_world_set_limits(SerdWorld* ZIX_NONNULL world, SerdLimits limits);
/**
Return a unique blank node.
@@ -68,8 +70,8 @@ serd_world_set_limits(SerdWorld* SERD_NONNULL world, SerdLimits limits);
The returned node is valid only until the next time serd_world_get_blank()
is called or the world is destroyed.
*/
-SERD_API const SerdNode* SERD_NONNULL
-serd_world_get_blank(SerdWorld* SERD_NONNULL world);
+SERD_API const SerdNode* ZIX_NONNULL
+serd_world_get_blank(SerdWorld* ZIX_NONNULL world);
/**
Set a function to be called when errors occur.
@@ -78,9 +80,9 @@ serd_world_get_blank(SerdWorld* SERD_NONNULL world);
no error function is set, errors are printed to stderr.
*/
SERD_API void
-serd_world_set_error_func(SerdWorld* SERD_NONNULL world,
- SerdErrorFunc SERD_NULLABLE error_func,
- void* SERD_NULLABLE handle);
+serd_world_set_error_func(SerdWorld* ZIX_NONNULL world,
+ SerdErrorFunc ZIX_NULLABLE error_func,
+ void* ZIX_NULLABLE handle);
/**
@}
diff --git a/include/serd/writer.h b/include/serd/writer.h
index c5f50b0c..60220570 100644
--- a/include/serd/writer.h
+++ b/include/serd/writer.h
@@ -12,6 +12,8 @@
#include "serd/stream.h"
#include "serd/syntax.h"
#include "serd/world.h"
+#include "zix/attributes.h"
+#include "zix/string_view.h"
#include <stdint.h>
@@ -46,21 +48,21 @@ typedef enum {
typedef uint32_t SerdWriterFlags;
/// Create a new RDF writer
-SERD_API SerdWriter* SERD_ALLOCATED
-serd_writer_new(SerdWorld* SERD_NONNULL world,
- SerdSyntax syntax,
- SerdWriterFlags flags,
- SerdEnv* SERD_NONNULL env,
- SerdWriteFunc SERD_NONNULL ssink,
- void* SERD_NULLABLE stream);
+SERD_API SerdWriter* ZIX_ALLOCATED
+serd_writer_new(SerdWorld* ZIX_NONNULL world,
+ SerdSyntax syntax,
+ SerdWriterFlags flags,
+ SerdEnv* ZIX_NONNULL env,
+ SerdWriteFunc ZIX_NONNULL ssink,
+ void* ZIX_NULLABLE stream);
/// Free `writer`
SERD_API void
-serd_writer_free(SerdWriter* SERD_NULLABLE writer);
+serd_writer_free(SerdWriter* ZIX_NULLABLE writer);
/// Return a sink interface that emits statements via `writer`
-SERD_CONST_API const SerdSink* SERD_NONNULL
-serd_writer_sink(SerdWriter* SERD_NONNULL writer);
+SERD_CONST_API const SerdSink* ZIX_NONNULL
+serd_writer_sink(SerdWriter* ZIX_NONNULL writer);
/**
Set a prefix to be removed from matching blank node identifiers.
@@ -69,8 +71,8 @@ serd_writer_sink(SerdWriter* SERD_NONNULL writer);
to "undo" added prefixes.
*/
SERD_API void
-serd_writer_chop_blank_prefix(SerdWriter* SERD_NONNULL writer,
- const char* SERD_NULLABLE prefix);
+serd_writer_chop_blank_prefix(SerdWriter* ZIX_NONNULL writer,
+ const char* ZIX_NULLABLE prefix);
/**
Set the current root URI.
@@ -83,8 +85,8 @@ serd_writer_chop_blank_prefix(SerdWriter* SERD_NONNULL writer,
it defaults to the base URI, so no up-references will be created at all.
*/
SERD_API SerdStatus
-serd_writer_set_root_uri(SerdWriter* SERD_NONNULL writer,
- const SerdNode* SERD_NULLABLE uri);
+serd_writer_set_root_uri(SerdWriter* ZIX_NONNULL writer,
+ const SerdNode* ZIX_NULLABLE uri);
/**
Finish a write.
@@ -93,7 +95,7 @@ serd_writer_set_root_uri(SerdWriter* SERD_NONNULL writer,
that the output is a complete document.
*/
SERD_API SerdStatus
-serd_writer_finish(SerdWriter* SERD_NONNULL writer);
+serd_writer_finish(SerdWriter* ZIX_NONNULL writer);
/**
@}
diff --git a/meson.build b/meson.build
index bfedbd54..c5748d89 100644
--- a/meson.build
+++ b/meson.build
@@ -116,6 +116,7 @@ exess_dep = dependency(
zix_dep = dependency(
'zix-0',
fallback: ['zix', 'zix_dep'],
+ include_type: 'system',
version: '>= 0.3.3',
)
@@ -232,7 +233,7 @@ if not get_option('tools').disabled()
'serdi',
files('src/serdi.c'),
c_args: c_suppressions + platform_c_args,
- dependencies: serd_dep,
+ dependencies: [serd_dep, zix_dep],
install: true,
link_args: tool_link_args,
)
diff --git a/src/byte_source.h b/src/byte_source.h
index 099fc515..d40012ea 100644
--- a/src/byte_source.h
+++ b/src/byte_source.h
@@ -6,11 +6,11 @@
#include "caret.h" // IWYU pragma: keep
-#include "serd/attributes.h"
#include "serd/caret.h"
#include "serd/node.h"
#include "serd/status.h"
#include "serd/stream.h"
+#include "zix/attributes.h"
#include <assert.h>
#include <stdbool.h>
@@ -60,7 +60,7 @@ serd_byte_source_prepare(SerdByteSource* source);
SerdStatus
serd_byte_source_page(SerdByteSource* source);
-SERD_PURE_FUNC static inline uint8_t
+ZIX_PURE_FUNC static inline uint8_t
serd_byte_source_peek(SerdByteSource* source)
{
assert(source->prepared);
diff --git a/src/env.c b/src/env.c
index b0f652c3..5159292d 100644
--- a/src/env.c
+++ b/src/env.c
@@ -7,6 +7,7 @@
#include "node.h"
#include "serd/node.h"
+#include "zix/attributes.h"
#include <assert.h>
#include <stdbool.h>
@@ -138,7 +139,7 @@ serd_env_set_base_uri(SerdEnv* const env, const SerdStringView uri)
return SERD_SUCCESS;
}
-SERD_PURE_FUNC static SerdPrefix*
+ZIX_PURE_FUNC static SerdPrefix*
serd_env_find(const SerdEnv* const env,
const char* const name,
const size_t name_len)
diff --git a/src/env.h b/src/env.h
index fcbd837e..21ce169a 100644
--- a/src/env.h
+++ b/src/env.h
@@ -4,12 +4,12 @@
#ifndef SERD_SRC_ENV_H
#define SERD_SRC_ENV_H
-#include "serd/attributes.h"
#include "serd/env.h"
#include "serd/node.h"
#include "serd/status.h"
#include "serd/string_view.h"
#include "serd/uri.h"
+#include "zix/attributes.h"
#include <stdbool.h>
@@ -32,7 +32,7 @@ serd_env_expand_in_place(const SerdEnv* env,
SerdStringView* uri_prefix,
SerdStringView* uri_suffix);
-SERD_PURE_FUNC SerdURIView
+ZIX_PURE_FUNC SerdURIView
serd_env_base_uri_view(const SerdEnv* env);
#endif // SERD_SRC_ENV_H
diff --git a/src/node.c b/src/node.c
index ba2490bb..cc29d7a1 100644
--- a/src/node.c
+++ b/src/node.c
@@ -8,7 +8,6 @@
#include "system.h"
#include "exess/exess.h"
-#include "serd/attributes.h"
#include "serd/buffer.h"
#include "serd/node.h"
#include "serd/status.h"
@@ -16,6 +15,7 @@
#include "serd/string_view.h"
#include "serd/uri.h"
#include "serd/write_result.h"
+#include "zix/attributes.h"
#include <assert.h>
#include <math.h>
@@ -26,8 +26,8 @@
#include <string.h>
typedef struct {
- const void* SERD_NULLABLE buf;
- size_t len;
+ const void* ZIX_NULLABLE buf;
+ size_t len;
} SerdConstBuffer;
#define NS_XSD "http://www.w3.org/2001/XMLSchema#"
@@ -63,7 +63,7 @@ string_sink(const void* const buf,
return nmemb;
}
-SERD_PURE_FUNC static size_t
+ZIX_PURE_FUNC static size_t
serd_node_pad_length(const size_t n_bytes)
{
const size_t pad = sizeof(SerdNode) - (n_bytes + 2) % sizeof(SerdNode);
@@ -84,7 +84,7 @@ serd_node_meta(SerdNode* const node)
return node + 1 + (serd_node_pad_length(node->length) / sizeof(SerdNode));
}
-SERD_PURE_FUNC static const SerdNode*
+ZIX_PURE_FUNC static const SerdNode*
serd_node_maybe_get_meta_c(const SerdNode* const node)
{
return (node->flags & meta_mask) ? serd_node_meta_c(node) : NULL;
@@ -106,7 +106,7 @@ serd_node_check_padding(const SerdNode* node)
#endif
}
-static SERD_PURE_FUNC size_t
+static ZIX_PURE_FUNC size_t
serd_node_total_size(const SerdNode* const node)
{
return node ? (sizeof(SerdNode) + serd_node_pad_length(node->length) +
@@ -790,7 +790,7 @@ serd_node_string_view(const SerdNode* const node)
return r;
}
-SERD_PURE_FUNC SerdURIView
+ZIX_PURE_FUNC SerdURIView
serd_node_uri_view(const SerdNode* const node)
{
assert(node);
diff --git a/src/node.h b/src/node.h
index ee903d3c..ed5a0c8f 100644
--- a/src/node.h
+++ b/src/node.h
@@ -5,10 +5,10 @@
#define SERD_SRC_NODE_H
#include "exess/exess.h"
-#include "serd/attributes.h"
#include "serd/node.h"
#include "serd/string_view.h"
#include "serd/uri.h"
+#include "zix/attributes.h"
#include <stdbool.h>
#include <stddef.h>
@@ -22,49 +22,49 @@ struct SerdNodeImpl {
static const size_t serd_node_align = 2 * sizeof(uint64_t);
-static inline char* SERD_NONNULL
-serd_node_buffer(SerdNode* SERD_NONNULL node)
+static inline char* ZIX_NONNULL
+serd_node_buffer(SerdNode* ZIX_NONNULL node)
{
return (char*)(node + 1);
}
-static inline const char* SERD_NONNULL
-serd_node_buffer_c(const SerdNode* SERD_NONNULL node)
+static inline const char* ZIX_NONNULL
+serd_node_buffer_c(const SerdNode* ZIX_NONNULL node)
{
return (const char*)(node + 1);
}
-static inline const char* SERD_NONNULL
-serd_node_string_i(const SerdNode* const SERD_NONNULL node)
+static inline const char* ZIX_NONNULL
+serd_node_string_i(const SerdNode* const ZIX_NONNULL node)
{
return (const char*)(node + 1);
}
static inline bool
-serd_node_pattern_match(const SerdNode* SERD_NULLABLE a,
- const SerdNode* SERD_NULLABLE b)
+serd_node_pattern_match(const SerdNode* ZIX_NULLABLE a,
+ const SerdNode* ZIX_NULLABLE b)
{
return !a || !b || serd_node_equals(a, b);
}
-SerdNode* SERD_ALLOCATED
+SerdNode* ZIX_ALLOCATED
serd_node_malloc(size_t length, SerdNodeFlags flags, SerdNodeType type);
void
-serd_node_set(SerdNode* SERD_NONNULL* SERD_NONNULL dst,
- const SerdNode* SERD_NONNULL src);
+serd_node_set(SerdNode* ZIX_NONNULL* ZIX_NONNULL dst,
+ const SerdNode* ZIX_NONNULL src);
void
-serd_node_zero_pad(SerdNode* SERD_NONNULL node);
+serd_node_zero_pad(SerdNode* ZIX_NONNULL node);
/// Create a new URI from a string, resolved against a base URI
-SerdNode* SERD_ALLOCATED
+SerdNode* ZIX_ALLOCATED
serd_new_resolved_uri(SerdStringView string, SerdURIView base_uri);
ExessResult
-serd_node_get_value_as(const SerdNode* SERD_NONNULL node,
- ExessDatatype value_type,
- size_t value_size,
- void* SERD_NONNULL value);
+serd_node_get_value_as(const SerdNode* ZIX_NONNULL node,
+ ExessDatatype value_type,
+ size_t value_size,
+ void* ZIX_NONNULL value);
#endif // SERD_SRC_NODE_H
diff --git a/src/reader.h b/src/reader.h
index 1c308824..9b9a217e 100644
--- a/src/reader.h
+++ b/src/reader.h
@@ -18,6 +18,7 @@
#include "serd/status.h"
#include "serd/syntax.h"
#include "serd/world.h"
+#include "zix/attributes.h"
#include <assert.h>
#include <stdbool.h>
@@ -68,10 +69,10 @@ push_node(SerdReader* reader,
const char* str,
size_t length);
-SERD_PURE_FUNC size_t
+ZIX_PURE_FUNC size_t
genid_length(const SerdReader* reader);
-SERD_PURE_FUNC bool
+ZIX_PURE_FUNC bool
tolerate_status(const SerdReader* reader, SerdStatus status);
SerdNode*
diff --git a/src/statement.h b/src/statement.h
index d4a64da5..9b9b553e 100644
--- a/src/statement.h
+++ b/src/statement.h
@@ -4,21 +4,21 @@
#ifndef SERD_SRC_STATEMENT_H
#define SERD_SRC_STATEMENT_H
-#include "serd/attributes.h"
#include "serd/caret.h"
#include "serd/node.h"
+#include "zix/attributes.h"
#include <stdbool.h>
struct SerdStatementImpl {
- const SerdNode* SERD_NULLABLE nodes[4];
- SerdCaret* SERD_NULLABLE caret;
+ const SerdNode* ZIX_NULLABLE nodes[4];
+ SerdCaret* ZIX_NULLABLE caret;
};
-SERD_PURE_FUNC bool
-serd_statement_is_valid(const SerdNode* SERD_NULLABLE subject,
- const SerdNode* SERD_NULLABLE predicate,
- const SerdNode* SERD_NULLABLE object,
- const SerdNode* SERD_NULLABLE graph);
+ZIX_PURE_FUNC bool
+serd_statement_is_valid(const SerdNode* ZIX_NULLABLE subject,
+ const SerdNode* ZIX_NULLABLE predicate,
+ const SerdNode* ZIX_NULLABLE object,
+ const SerdNode* ZIX_NULLABLE graph);
#endif // SERD_SRC_STATEMENT_H
diff --git a/src/system.h b/src/system.h
index bfe2c2f0..ba5301fd 100644
--- a/src/system.h
+++ b/src/system.h
@@ -4,7 +4,7 @@
#ifndef SERD_SRC_SYSTEM_H
#define SERD_SRC_SYSTEM_H
-#include "serd/attributes.h"
+#include "zix/attributes.h"
#include <stdint.h>
#include <stdio.h>
@@ -16,15 +16,15 @@ int
serd_system_strerror(int errnum, char* buf, size_t buflen);
/// Allocate a buffer aligned to `alignment` bytes
-SERD_MALLOC_FUNC void*
+ZIX_MALLOC_FUNC void*
serd_malloc_aligned(size_t alignment, size_t size);
/// Allocate a zeroed buffer aligned to `alignment` bytes
-SERD_MALLOC_FUNC void*
+ZIX_MALLOC_FUNC void*
serd_calloc_aligned(size_t alignment, size_t size);
/// Allocate an aligned buffer for I/O
-SERD_MALLOC_FUNC void*
+ZIX_MALLOC_FUNC void*
serd_allocate_buffer(size_t size);
/// Free a buffer allocated with an aligned allocation function
diff --git a/src/uri_utils.h b/src/uri_utils.h
index 36db5fb5..004129d2 100644
--- a/src/uri_utils.h
+++ b/src/uri_utils.h
@@ -46,7 +46,7 @@ uri_path_at(const SerdURIView* uri, size_t i)
slash is the last in the root, then the URI is a child of the root,
otherwise it may merely share some leading path components).
*/
-static inline SERD_PURE_FUNC SlashIndexes
+static inline ZIX_PURE_FUNC SlashIndexes
uri_rooted_index(const SerdURIView* uri, const SerdURIView* root)
{
SlashIndexes indexes = {SIZE_MAX, SIZE_MAX};
@@ -84,7 +84,7 @@ uri_rooted_index(const SerdURIView* uri, const SerdURIView* root)
}
/** Return true iff `uri` shares path components with `root` */
-static inline SERD_PURE_FUNC bool
+static inline ZIX_PURE_FUNC bool
uri_is_related(const SerdURIView* uri, const SerdURIView* root)
{
return root && root->scheme.length &&
@@ -93,7 +93,7 @@ uri_is_related(const SerdURIView* uri, const SerdURIView* root)
}
/** Return true iff `uri` is within the base of `root` */
-static inline SERD_PURE_FUNC bool
+static inline ZIX_PURE_FUNC bool
uri_is_under(const SerdURIView* uri, const SerdURIView* root)
{
const SlashIndexes indexes = uri_rooted_index(uri, root);
diff --git a/test/headers/meson.build b/test/headers/meson.build
index 6cb14f6e..bf8a2456 100644
--- a/test/headers/meson.build
+++ b/test/headers/meson.build
@@ -37,7 +37,7 @@ test(
'test_headers',
files('test_headers.c'),
c_args: header_c_suppressions,
- dependencies: serd_dep,
+ dependencies: [serd_dep, zix_dep],
),
suite: 'unit',
)
diff --git a/test/headers/test_headers.c b/test/headers/test_headers.c
index 62be0976..48b1814b 100644
--- a/test/headers/test_headers.c
+++ b/test/headers/test_headers.c
@@ -2,8 +2,9 @@
// SPDX-License-Identifier: ISC
#include "serd/serd.h" // IWYU pragma: keep
+#include "zix/attributes.h"
-SERD_CONST_FUNC int
+ZIX_CONST_FUNC int
main(void)
{
return 0;
diff --git a/test/test_string.c b/test/test_string.c
index 49106f0a..b551b9fe 100644
--- a/test/test_string.c
+++ b/test/test_string.c
@@ -3,10 +3,10 @@
#undef NDEBUG
-#include "serd/attributes.h"
#include "serd/node.h"
#include "serd/status.h"
#include "serd/string.h"
+#include "zix/attributes.h"
#include <assert.h>
#include <stdint.h>
@@ -38,7 +38,7 @@ test_strerror(void)
assert(!strcmp(msg, "Unknown error"));
}
-SERD_PURE_FUNC int
+ZIX_PURE_FUNC int
main(void)
{
test_strlen();