X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fadt%2Farray.c;h=6f9618482bee0a1960ac0e16b622862570b2e634;hb=4191bc604f9c4cbc8be4c41bf94110db565bf86e;hp=592bead144a24ce951f87a24ccb168554c11851c;hpb=6944f6a6832abebd5862f03ee7ec3dad7217aa37;p=libfirm diff --git a/ir/adt/array.c b/ir/adt/array.c index 592bead14..6f9618482 100644 --- a/ir/adt/array.c +++ b/ir/adt/array.c @@ -14,7 +14,9 @@ # include "config.h" #endif -#include +#ifdef HAVE_STDLIB_H +# include +#endif #include "array.h" #include "xmalloc.h" @@ -179,3 +181,25 @@ _arr_resize (void *elts, int nelts, size_t eltsize) return dp->v.elts; } + +#ifdef DEBUG_libfirm +/** + * This function returns the length of a flexible array. + * Do NOT use is in code, use ARR_LEN() macro! + * This function is intended to be called from a debugger. + */ +int array_len(void *arr) { + return ARR_LEN(arr); +} + +/** + * This function returns the array descriptor of a flexible array. + * Do NOT use is in code!. + * This function is intended to be called from a debugger. + */ +_arr_descr *array_descr(void *arr) { + if (! arr) + return NULL; + return _ARR_DESCR(arr); +} +#endif /* DEBUG_libfirm */