summaryrefslogtreecommitdiffhomepage
path: root/include/stc/priv
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-07 12:30:39 +0100
committerTyge Løvset <[email protected]>2023-02-07 12:30:39 +0100
commitca54204557669fb54f43959594ee92109fcc75b6 (patch)
tree9880ad3d7e3dca7e309e0b96f5c88ebbb0552853 /include/stc/priv
parent3cb564e7274b7749531742fa7c50fd928fdbe2d9 (diff)
downloadSTC-modified-ca54204557669fb54f43959594ee92109fcc75b6.tar.gz
STC-modified-ca54204557669fb54f43959594ee92109fcc75b6.zip
Added custom allocator per container type.
Diffstat (limited to 'include/stc/priv')
-rw-r--r--include/stc/priv/altnames.h5
-rw-r--r--include/stc/priv/template.h16
2 files changed, 18 insertions, 3 deletions
diff --git a/include/stc/priv/altnames.h b/include/stc/priv/altnames.h
index e3ce03a0..0b01d251 100644
--- a/include/stc/priv/altnames.h
+++ b/include/stc/priv/altnames.h
@@ -20,9 +20,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#define c_alloc c_ALLOC
-#define c_new c_NEW
-#define c_arraylen c_ARRAYLEN
#define c_forlist c_FORLIST
#define c_forrange c_FORRANGE
#define c_foreach c_FOREACH
@@ -38,3 +35,5 @@
#define c_defer c_DEFER
#define c_sv c_SV
#define c_ARGSV c_SVARG
+#define c_NEW c_new
+#define c_ARRAYLEN c_arraylen
diff --git a/include/stc/priv/template.h b/include/stc/priv/template.h
index 6eb82bcb..79627ff3 100644
--- a/include/stc/priv/template.h
+++ b/include/stc/priv/template.h
@@ -48,6 +48,16 @@
#define i_size intptr_t
#endif
+#ifndef i_allocator
+ #define i_allocator c_
+#endif
+#ifndef i_malloc
+ #define i_malloc c_PASTE(i_allocator, malloc)
+ #define i_calloc c_PASTE(i_allocator, calloc)
+ #define i_realloc c_PASTE(i_allocator, realloc)
+ #define i_free c_PASTE(i_allocator, free)
+#endif
+
#if !(defined i_key || defined i_key_str || defined i_key_ssv || \
defined i_keyclass || defined i_keyboxed)
#if defined _i_ismap
@@ -317,6 +327,12 @@
#undef i_static
#undef i_extern
+#undef i_allocator
+#undef i_malloc
+#undef i_calloc
+#undef i_realloc
+#undef i_free
+
#undef i_no_cmp
#undef i_no_eq
#undef i_no_hash