summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/zix/common.h29
-rw-r--r--meson.build1
-rw-r--r--src/status.c28
3 files changed, 35 insertions, 23 deletions
diff --git a/include/zix/common.h b/include/zix/common.h
index eaac408..02b0f64 100644
--- a/include/zix/common.h
+++ b/include/zix/common.h
@@ -4,6 +4,8 @@
#ifndef ZIX_COMMON_H
#define ZIX_COMMON_H
+#include "zix/attributes.h"
+
#include <stdbool.h>
/**
@@ -26,29 +28,10 @@ typedef enum {
ZIX_STATUS_REACHED_END
} ZixStatus;
-static inline const char*
-zix_strerror(const ZixStatus status)
-{
- switch (status) {
- case ZIX_STATUS_SUCCESS:
- return "Success";
- case ZIX_STATUS_ERROR:
- return "Unknown error";
- case ZIX_STATUS_NO_MEM:
- return "Out of memory";
- case ZIX_STATUS_NOT_FOUND:
- return "Not found";
- case ZIX_STATUS_EXISTS:
- return "Exists";
- case ZIX_STATUS_BAD_ARG:
- return "Bad argument";
- case ZIX_STATUS_BAD_PERMS:
- return "Bad permissions";
- case ZIX_STATUS_REACHED_END:
- return "Reached end";
- }
- return "Unknown error";
-}
+/// Return a string describing a status code
+ZIX_API
+const char*
+zix_strerror(ZixStatus status);
/// Function for comparing two elements
typedef int (*ZixComparator)(const void* a,
diff --git a/meson.build b/meson.build
index 5b54107..4cdecf5 100644
--- a/meson.build
+++ b/meson.build
@@ -95,6 +95,7 @@ sources = files(
'src/digest.c',
'src/hash.c',
'src/ring.c',
+ 'src/status.c',
'src/tree.c',
)
diff --git a/src/status.c b/src/status.c
new file mode 100644
index 0000000..b932ff4
--- /dev/null
+++ b/src/status.c
@@ -0,0 +1,28 @@
+// Copyright 2014-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
+
+#include "zix/common.h"
+
+const char*
+zix_strerror(const ZixStatus status)
+{
+ switch (status) {
+ case ZIX_STATUS_SUCCESS:
+ return "Success";
+ case ZIX_STATUS_ERROR:
+ return "Unknown error";
+ case ZIX_STATUS_NO_MEM:
+ return "Out of memory";
+ case ZIX_STATUS_NOT_FOUND:
+ return "Not found";
+ case ZIX_STATUS_EXISTS:
+ return "Exists";
+ case ZIX_STATUS_BAD_ARG:
+ return "Bad argument";
+ case ZIX_STATUS_BAD_PERMS:
+ return "Bad permissions";
+ case ZIX_STATUS_REACHED_END:
+ return "Reached end";
+ }
+ return "Unknown error";
+}