Skip to content

Commit e655a89

Browse files
committed
Bump version
1 parent 3ab212b commit e655a89

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

extlib.h

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* extlib v1.4.1 - c extended library
2+
* extlib v2.0.0 - c extended library
33
*
44
* Single-header-file library that provides functionality that extends the standard c library.
55
* Features:
@@ -43,6 +43,32 @@
4343
*
4444
* Changelog:
4545
*
46+
* v2.0.0:
47+
* - Breaking changes on hashmap implementation:
48+
* Reworked the hashmap implementation to make possible the usage of `ext_hmap_get` and
49+
* `ext_hmap_get_default` family of functions as expressions. Now it is possible to do
50+
* things like:
51+
* ```c
52+
* Entry* e = hmap_get_cstr(&hmap, "key");
53+
* if(e != NULL) {
54+
* ...
55+
* }
56+
* ```
57+
*
58+
* - Added `Ext_Array` and `Ext_HashMap`/`Ext_Entry` macros to define required struct layout
59+
* for both dynamic arrays and hashmap in-line.
60+
* This makes it possible to skip declaring the full struct by hand when we do not need
61+
* to reference it by name (i.e. create variables to it, pass it to functions, etc.):
62+
* ```c
63+
* Array(int) int_array = {0};
64+
* HashMap(char*, int) int_map = {0};
65+
* ```
66+
* Declaring full struct layout by hand is still supported.
67+
*
68+
* - Breaking change: removed deprecated functions and macros:
69+
* 1. ext_strdup_alloc and ext_memdup_alloc
70+
* 2. ext_defer_loop
71+
*
4672
* v1.4.1:
4773
* - Minor tweaks to allocation functions - move some of them to be `inline`
4874
*
@@ -454,7 +480,7 @@ Ext_Context *ext_pop_context(void);
454480
// }
455481
// // ... context automatically popped
456482
// ```
457-
#define EXT_PUSH_CONTEXT(ctx) EXT_DEFER_LOOP(ext_push_context(ctx), ext_pop_context())
483+
#define EXT_PUSH_CONTEXT(ctx) ext_defer_loop(ext_push_context(ctx), ext_pop_context())
458484

459485
// Utility macro to push/pop context with an allocator between code.
460486
// Simplifies pushing when the only thing you want to customize is the allocator.
@@ -469,7 +495,7 @@ Ext_Context *ext_pop_context(void);
469495
#define EXT_PUSH_ALLOCATOR(allocator) \
470496
Ext_Context EXT_CONCAT_(ctx_, __LINE__) = *ext_context; \
471497
EXT_CONCAT_(ctx_, __LINE__).alloc = (allocator); \
472-
EXT_DEFER_LOOP(ext_push_context(&EXT_CONCAT_(ctx_, __LINE__)), ext_pop_context())
498+
ext_defer_loop(ext_push_context(&EXT_CONCAT_(ctx_, __LINE__)), ext_pop_context())
473499

474500
// Utility macro to push/pop a context with the given logging level set.
475501
// Simplifies pushing when the only thing you want to customize is the logging level.
@@ -485,7 +511,7 @@ Ext_Context *ext_pop_context(void);
485511
#define EXT_LOGGING_LEVEL(level) \
486512
Ext_Context EXT_CONCAT_(ctx_, __LINE__) = *ext_context; \
487513
EXT_CONCAT_(ctx_, __LINE__).log_level = (level); \
488-
EXT_DEFER_LOOP(ext_push_context(&EXT_CONCAT_(ctx_, __LINE__)), ext_pop_context())
514+
ext_defer_loop(ext_push_context(&EXT_CONCAT_(ctx_, __LINE__)), ext_pop_context())
489515

490516
// -----------------------------------------------------------------------------
491517
// SECTION: Allocators
@@ -3716,7 +3742,6 @@ static inline int ext_dbg_unknown(const char *name, const char *file, int line,
37163742
#define GiB EXT_GiB
37173743
#define PRINTF_FORMAT EXT_PRINTF_FORMAT
37183744
#define defer_loop ext_defer_loop
3719-
#define DEFER_LOOP EXT_DEFER_LOOP
37203745
#define return_exit ext_return_exit
37213746

37223747
#define DEBUG EXT_DEBUG

0 commit comments

Comments
 (0)