diff options
Diffstat (limited to 'src/u8c/end.c')
-rw-r--r-- | src/u8c/end.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/u8c/end.c b/src/u8c/end.c index af9661c..633ced7 100644 --- a/src/u8c/end.c +++ b/src/u8c/end.c @@ -13,24 +13,31 @@ If not, see <https://www.gnu.org/licenses/>. */ -# include "err.h" -# include "errlock.h" -# include "stat.h" +# include "dat.h" +# include <stdbool.h> # include <stdint.h> # include <stdlib.h> # include <u8c/end.h> +# include <u8c/SIZE_C.h> # include <u8c/u32free.h> # if defined(u8c_bethrdsafe) # include <threads.h> # endif -uint_least8_t u8c_end(void) { - if(u8c_stat) { - return UINT8_C(0x0); +bool u8c_end(void) { + if(u8c_dat.stat) { + return false; } # if defined(u8c_bethrdsafe) - mtx_destroy(&u8c_errlock); + /* Destroy mutexes */ + mtx_destroy(&u8c_dat.errlock); + mtx_destroy(&u8c_dat.fmtlock); # endif - u8c_u32free(u8c_err); - u8c_stat = UINT8_C(0x1); - return UINT8_C(0x0); + /* Free error message: */ + u8c_u32free(&u8c_dat.err); + /* Set default formatting options: */ + u8c_dat.fmtbase = UINT8_C(0xC); + u8c_dat.fmtendian = UINT8_C(0x0); + /* Set status: */ + u8c_dat.stat = UINT8_C(0x1); + return false; } |