diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2021-04-19 11:03:35 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2021-04-19 11:03:35 -0400 |
commit | d9de45ac3fffd9affa059d7404234f79ba00dfae (patch) | |
tree | 8d1bc183a922b294537dcc4c086f955aecd99840 /src/ext_depends/d2sqlite3/source | |
parent | org-mode, cosmetic (diff) |
ext-dep: d2sqlite3 updated
Diffstat (limited to 'src/ext_depends/d2sqlite3/source')
-rw-r--r-- | src/ext_depends/d2sqlite3/source/d2sqlite3/internal/memory.d | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/ext_depends/d2sqlite3/source/d2sqlite3/internal/memory.d b/src/ext_depends/d2sqlite3/source/d2sqlite3/internal/memory.d index 664dbdd..afc3a4b 100644 --- a/src/ext_depends/d2sqlite3/source/d2sqlite3/internal/memory.d +++ b/src/ext_depends/d2sqlite3/source/d2sqlite3/internal/memory.d @@ -66,22 +66,17 @@ extern(C) void releaseMem(const void* ptr) // Adapted from https://p0nce.github.io/d-idioms/#GC-proof-resource-class void ensureNotInGC(T)(string info = null) nothrow { - import core.exception : InvalidMemoryOperationError; - try - { - import core.memory : GC; - cast(void) GC.malloc(1); + import core.memory : GC; + import core.stdc.stdio : fprintf, stderr; + import core.stdc.stdlib : exit; + + if (!GC.inFinalizer) return; - } - catch(InvalidMemoryOperationError e) - { - import core.stdc.stdio : fprintf, stderr; - import core.stdc.stdlib : exit; - fprintf(stderr, - "Error: clean-up of %s incorrectly depends on destructors called by the GC.\n", - T.stringof.ptr); - if (info) - fprintf(stderr, "Info: %s\n", info.ptr); - assert(false); - } + + fprintf(stderr, + "Error: clean-up of %s incorrectly depends on destructors called by the GC.\n", + T.stringof.ptr); + if (info) + fprintf(stderr, "Info: %s\n", info.ptr); + assert(false); } |