From 55a57dbf9eb2dec7f6361aea62a26883682d3aad Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Wed, 27 Nov 2019 07:58:12 +0000 Subject: [PATCH] made moo_rbt_getxtn() inline --- moo/lib/moo-rbt.h | 8 +++++--- moo/lib/rbt.c | 5 ----- moo/lib/utl.c | 6 +++--- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/moo/lib/moo-rbt.h b/moo/lib/moo-rbt.h index 4c2d6f7..51442c7 100644 --- a/moo/lib/moo-rbt.h +++ b/moo/lib/moo-rbt.h @@ -324,9 +324,11 @@ MOO_EXPORT void moo_rbt_fini ( moo_rbt_t* rbt /**< red-black tree */ ); -MOO_EXPORT void* moo_rbt_getxtn ( - moo_rbt_t* rbt -); +#if defined(MOO_HAVE_INLINE) +static MOO_INLINE void* moo_rbt_getxtn (moo_rbt_t* rbt) { return (void*)(rbt + 1); } +#else +#define moo_rbt_getxtn(awk) ((void*)((moo_rbt_t*)(rbt) + 1)) +#endif /** * The moo_rbt_getstyle() function gets manipulation callback function set. diff --git a/moo/lib/rbt.c b/moo/lib/rbt.c index e5ab404..d4e67bf 100644 --- a/moo/lib/rbt.c +++ b/moo/lib/rbt.c @@ -243,11 +243,6 @@ void moo_rbt_fini (moo_rbt_t* rbt) moo_rbt_clear (rbt); } -void* moo_rbt_getxtn (moo_rbt_t* rbt) -{ - return (void*)(rbt + 1); -} - const moo_rbt_style_t* moo_rbt_getstyle (const moo_rbt_t* rbt) { return rbt->style; diff --git a/moo/lib/utl.c b/moo/lib/utl.c index 4d03775..84b69be 100644 --- a/moo/lib/utl.c +++ b/moo/lib/utl.c @@ -692,7 +692,7 @@ MOO_INLINE int moo_conv_bcstr_to_ucstr_with_cmgr ( for (bp = bcs; *bp != '\0'; bp++) /* nothing */ ; mlen = bp - bcs; wlen = *ucslen; - n = moo_conv_bchars_to_uchars_with_cmgr (bcs, &mlen, ucs, &wlen, cmgr, all); + n = moo_conv_bchars_to_uchars_with_cmgr(bcs, &mlen, ucs, &wlen, cmgr, all); if (ucs) { /* null-terminate the target buffer if it has room for it. */ @@ -726,7 +726,7 @@ MOO_INLINE int moo_conv_uchars_to_bchars_with_cmgr ( break; } - n = cmgr->uctobc (*p, bcs, rem); + n = cmgr->uctobc(*p, bcs, rem); if (n == 0) { ret = -1; @@ -751,7 +751,7 @@ MOO_INLINE int moo_conv_uchars_to_bchars_with_cmgr ( { moo_oow_t n; - n = cmgr->uctobc (*p, bcsbuf, MOO_COUNTOF(bcsbuf)); + n = cmgr->uctobc(*p, bcsbuf, MOO_COUNTOF(bcsbuf)); if (n == 0) { ret = -1;