summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile2
-rw-r--r--changelog.md7
-rw-r--r--include/u8c/ver.h2
-rw-r--r--src/u8c/dattyp.h3
-rw-r--r--src/u8c/end.c1
-rw-r--r--src/u8c/init.c7
7 files changed, 20 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 65d6eed..43a49ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
*.o
*.so
+*.zst
/test
/txttolit
vgcore.*
diff --git a/Makefile b/Makefile
index 42cd61c..ee9e7b8 100644
--- a/Makefile
+++ b/Makefile
@@ -113,7 +113,7 @@ DOCS = \
docs/u8c_isalnum.3.zst \
docs/u8c_isalpha.3.zst \
docs/u8c_iscntrl.3.zst \
- docs/u8c_digit.3.zst \
+ docs/u8c_isdigit.3.zst \
docs/u8c_ispunct.3.zst \
docs/u8c_isspace.3.zst \
docs/u8c_isxdigit.3.zst \
diff --git a/changelog.md b/changelog.md
index 90a18e3..2730b94 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,10 @@
+# 1↊
+
+* Initialise error handler array.
+* Initialise and destroy error handler array mutex.
+* Fix Makefile.
+* Update gitignore.
+
# 19
* Fix error when compiling with GCC: *src/u8c/dat.c:22:29: error: initializer element is not constant [-Wpedantic]*.
diff --git a/include/u8c/ver.h b/include/u8c/ver.h
index 3f59f1a..e383351 100644
--- a/include/u8c/ver.h
+++ b/include/u8c/ver.h
@@ -17,5 +17,5 @@
# if !defined(u8c_sym_ver)
# define u8c_sym_ver
# include <stdint.h>
-# define u8c_ver (UINT64_C(0x15))
+# define u8c_ver (UINT64_C(0x17))
# endif
diff --git a/src/u8c/dattyp.h b/src/u8c/dattyp.h
index 1a1e830..aa61b21 100644
--- a/src/u8c/dattyp.h
+++ b/src/u8c/dattyp.h
@@ -16,6 +16,7 @@
# if !defined(u8c_sym_dattyp)
# define u8c_sym_dattyp
# include <stdbool.h>
+# include <stddef.h>
# include <stdint.h>
# include <u8c/errhandltyp.h>
# include <u8c/errtyp.h>
@@ -28,7 +29,7 @@ struct u8c_dattyp {
bool fmtendian;
unsigned char pad0[sizeof(void(*)(void)) - SIZE_C(0x1)]; /* Padding. */
char32_t const * err;
- u8c_errhandltyp errhandls[u8c_errtyp_maxerrtyp];
+ u8c_errhandltyp errhandls[(size_t)u8c_errtyp_maxerrtyp];
uint_least8_t fmtbase;
uint_least8_t stat;
# if defined(u8c_bethrdsafe)
diff --git a/src/u8c/end.c b/src/u8c/end.c
index adfd8d6..80d39aa 100644
--- a/src/u8c/end.c
+++ b/src/u8c/end.c
@@ -29,6 +29,7 @@ bool u8c_end(void) {
}
# if defined(u8c_bethrdsafe)
/* Destroy mutexes: */
+ mtx_destroy(&u8c_dat.errhandlslock);
mtx_destroy(&u8c_dat.errlock);
mtx_destroy(&u8c_dat.fmtlock);
# endif
diff --git a/src/u8c/init.c b/src/u8c/init.c
index f2e4948..0b8a100 100644
--- a/src/u8c/init.c
+++ b/src/u8c/init.c
@@ -28,6 +28,9 @@
bool u8c_init() {
/* Initialise mutexes: */
# if defined(u8c_bethrdsafe)
+ if(mtx_init(&u8c_dat.errhandlslock,mtx_plain) == thrd_error) {
+ return true;
+ }
if(mtx_init(&u8c_dat.errlock,mtx_plain) == thrd_error) {
return true;
}
@@ -38,6 +41,10 @@ bool u8c_init() {
/* Set default error message: */
u8c_dat.err = NULL;
u8c_seterr(U"",u8c_errtyp_deferr);
+ /* Initialise error handler array: */
+ for(register size_t n = SIZE_C(0x0);n < u8c_errtyp_maxerrtyp;n += SIZE_C(0x1)) {
+ u8c_dat.errhandls[n] = NULL;
+ }
/* Set status: */
u8c_dat.stat = UINT8_C(0x1);
return false;