diff options
Diffstat (limited to 'Source/DOH/base.c')
-rw-r--r-- | Source/DOH/base.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/Source/DOH/base.c b/Source/DOH/base.c index f5e418893..8731a5f11 100644 --- a/Source/DOH/base.c +++ b/Source/DOH/base.c @@ -4,7 +4,7 @@ * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. + * and at https://www.swig.org/legal.html. * * base.c * @@ -18,10 +18,6 @@ * DohDelete() * ----------------------------------------------------------------------------- */ -#ifndef SWIG_DEBUG_DELETE -#define SWIG_DEBUG_DELETE 0 -#endif - void DohDelete(DOH *obj) { DohBase *b = (DohBase *) obj; DohObjInfo *objinfo; @@ -29,13 +25,8 @@ void DohDelete(DOH *obj) { if (!obj) return; if (!DohCheck(b)) { -#if SWIG_DEBUG_DELETE - fputs("DOH: Fatal error. Attempt to delete a non-doh object.\n", stderr); - abort(); -#else - assert(0); -#endif - return; + fputs("Fatal internal error: Attempt to delete a non-DOH object.\n", stderr); + Exit(EXIT_FAILURE); } if (b->flag_intern) return; @@ -64,13 +55,8 @@ DOH *DohCopy(const DOH *obj) { if (!obj) return 0; if (!DohCheck(b)) { -#if SWIG_DEBUG_DELETE - fputs("DOH: Fatal error. Attempt to copy a non-doh object.\n", stderr); - abort(); -#else - assert(0); -#endif - return 0; + fputs("Fatal internal error: Attempt to copy a non-DOH object.\n", stderr); + Exit(EXIT_FAILURE); } objinfo = b->type; if (objinfo->doh_copy) { @@ -389,6 +375,18 @@ DOH *DohKeys(DOH *obj) { } /* ----------------------------------------------------------------------------- + * DohSortedKeys() + * ----------------------------------------------------------------------------- */ + +DOH *DohSortedKeys(DOH *obj, int (*cmp) (const DOH *, const DOH *)) { + DOHList *keys = DohKeys(obj); + if (keys) { + DohSortList(keys, cmp); + } + return keys; +} + +/* ----------------------------------------------------------------------------- * DohGetInt() * ----------------------------------------------------------------------------- */ |