From 8bf6b40d498436eb850721aaeda17b58f728ab6d Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Sat, 16 Nov 2019 15:54:22 +0000 Subject: [PATCH] renamed some types and variables for consistency --- moo/lib/err.c | 20 ++++++++++---------- moo/lib/fmt.c | 24 ++++++++++++------------ moo/lib/moo-utl.h | 20 ++++++++++---------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/moo/lib/err.c b/moo/lib/err.c index fb97a23..99e444e 100644 --- a/moo/lib/err.c +++ b/moo/lib/err.c @@ -221,7 +221,7 @@ void moo_seterrnum (moo_t* moo, moo_errnum_t errnum) } -static int err_bcs (moo_fmtout_t* fmtout, const moo_bch_t* ptr, moo_oow_t len) +static int err_bchars (moo_fmtout_t* fmtout, const moo_bch_t* ptr, moo_oow_t len) { moo_t* moo = (moo_t*)fmtout->ctx; moo_oow_t max; @@ -244,7 +244,7 @@ static int err_bcs (moo_fmtout_t* fmtout, const moo_bch_t* ptr, moo_oow_t len) return 1; /* success */ } -static int err_ucs (moo_fmtout_t* fmtout, const moo_uch_t* ptr, moo_oow_t len) +static int err_uchars (moo_fmtout_t* fmtout, const moo_uch_t* ptr, moo_oow_t len) { moo_t* moo = (moo_t*)fmtout->ctx; moo_oow_t max; @@ -274,8 +274,8 @@ void moo_seterrbfmt (moo_t* moo, moo_errnum_t errnum, const moo_bch_t* fmt, ...) moo->errmsg.len = 0; MOO_MEMSET (&fo, 0, MOO_SIZEOF(fo)); - fo.putbcs = err_bcs; - fo.putucs = err_ucs; + fo.putbchars = err_bchars; + fo.putuchars = err_uchars; fo.putobj = moo_fmt_object_; fo.ctx = moo; @@ -295,8 +295,8 @@ void moo_seterrufmt (moo_t* moo, moo_errnum_t errnum, const moo_uch_t* fmt, ...) moo->errmsg.len = 0; MOO_MEMSET (&fo, 0, MOO_SIZEOF(fo)); - fo.putbcs = err_bcs; - fo.putucs = err_ucs; + fo.putbchars = err_bchars; + fo.putuchars = err_uchars; fo.putobj = moo_fmt_object_; fo.ctx = moo; @@ -317,8 +317,8 @@ void moo_seterrbfmtv (moo_t* moo, moo_errnum_t errnum, const moo_bch_t* fmt, va_ moo->errmsg.len = 0; MOO_MEMSET (&fo, 0, MOO_SIZEOF(fo)); - fo.putbcs = err_bcs; - fo.putucs = err_ucs; + fo.putbchars = err_bchars; + fo.putuchars = err_uchars; fo.putobj = moo_fmt_object_; fo.ctx = moo; @@ -335,8 +335,8 @@ void moo_seterrufmtv (moo_t* moo, moo_errnum_t errnum, const moo_uch_t* fmt, va_ moo->errmsg.len = 0; MOO_MEMSET (&fo, 0, MOO_SIZEOF(fo)); - fo.putbcs = err_bcs; - fo.putucs = err_ucs; + fo.putbchars = err_bchars; + fo.putuchars = err_uchars; fo.putobj = moo_fmt_object_; fo.ctx = moo; diff --git a/moo/lib/fmt.c b/moo/lib/fmt.c index b013fe1..65e1b2b 100644 --- a/moo/lib/fmt.c +++ b/moo/lib/fmt.c @@ -211,7 +211,7 @@ static moo_bch_t* sprintn_upper (moo_bch_t* nbuf, moo_uintmax_t num, int base, m for (_yy = 0; _yy < n; _yy++) \ { \ int _xx; \ - if ((_xx = fmtout->putbcs(fmtout, &_cc, 1)) <= -1) goto oops; \ + if ((_xx = fmtout->putbchars(fmtout, &_cc, 1)) <= -1) goto oops; \ if (_xx == 0) goto done; \ fmtout->count++; \ } \ @@ -221,7 +221,7 @@ static moo_bch_t* sprintn_upper (moo_bch_t* nbuf, moo_uintmax_t num, int base, m #define PUT_BCS(fmtout,ptr,len) do { \ if (len > 0) { \ int _xx; \ - if ((_xx = fmtout->putbcs(fmtout, ptr, len)) <= -1) goto oops; \ + if ((_xx = fmtout->putbchars(fmtout, ptr, len)) <= -1) goto oops; \ if (_xx == 0) goto done; \ fmtout->count += len; \ } \ @@ -234,7 +234,7 @@ static moo_bch_t* sprintn_upper (moo_bch_t* nbuf, moo_uintmax_t num, int base, m for (_yy = 0; _yy < n; _yy++) \ { \ int _xx; \ - if ((_xx = fmtout->putucs(fmtout, &_cc, 1)) <= -1) goto oops; \ + if ((_xx = fmtout->putuchars(fmtout, &_cc, 1)) <= -1) goto oops; \ if (_xx == 0) goto done; \ fmtout->count++; \ } \ @@ -244,7 +244,7 @@ static moo_bch_t* sprintn_upper (moo_bch_t* nbuf, moo_uintmax_t num, int base, m #define PUT_UCS(fmtout,ptr,len) do { \ if (len > 0) { \ int _xx; \ - if ((_xx = fmtout->putucs(fmtout, ptr, len)) <= -1) goto oops; \ + if ((_xx = fmtout->putuchars(fmtout, ptr, len)) <= -1) goto oops; \ if (_xx == 0) goto done; \ fmtout->count += len; \ } \ @@ -1896,8 +1896,8 @@ moo_ooi_t moo_logbfmtv (moo_t* moo, moo_bitmask_t mask, const moo_bch_t* fmt, va fo.fmt_str = fmt; fo.ctx = moo; fo.mask = mask; - fo.putbcs = log_bcs; - fo.putucs = log_ucs; + fo.putbchars = log_bcs; + fo.putuchars = log_ucs; fo.putobj = moo_fmt_object_; x = fmt_outv(&fo, ap); @@ -1950,8 +1950,8 @@ moo_ooi_t moo_logufmtv (moo_t* moo, moo_bitmask_t mask, const moo_uch_t* fmt, va fo.fmt_str = fmt; fo.ctx = moo; fo.mask = mask; - fo.putbcs = log_bcs; - fo.putucs = log_ucs; + fo.putbchars = log_bcs; + fo.putuchars = log_ucs; fo.putobj = moo_fmt_object_; x = fmt_outv(&fo, ap); @@ -1980,7 +1980,7 @@ moo_ooi_t moo_logufmt (moo_t* moo, moo_bitmask_t mask, const moo_uch_t* fmt, ... * STRING FORMATTING * -------------------------------------------------------------------------- */ -static int sprint_bcs (moo_fmtout_t* fmtout, const moo_bch_t* ptr, moo_oow_t len) +static int sprint_bchars (moo_fmtout_t* fmtout, const moo_bch_t* ptr, moo_oow_t len) { moo_t* moo = (moo_t*)fmtout->ctx; moo_oow_t unused, oolen, blen; @@ -2019,7 +2019,7 @@ static int sprint_bcs (moo_fmtout_t* fmtout, const moo_bch_t* ptr, moo_oow_t len return 1; /* success */ } -static int sprint_ucs (moo_fmtout_t* fmtout, const moo_uch_t* ptr, moo_oow_t len) +static int sprint_uchars (moo_fmtout_t* fmtout, const moo_uch_t* ptr, moo_oow_t len) { moo_t* moo = (moo_t*)fmtout->ctx; moo_oow_t unused, oolen, ulen; @@ -2797,8 +2797,8 @@ int moo_strfmtcallstack (moo_t* moo, moo_ooi_t nargs, int rcv_is_fmtstr) MOO_MEMSET (&fo, 0, MOO_SIZEOF(fo)); fo.ctx = moo; - fo.putbcs = sprint_bcs; - fo.putucs = sprint_ucs; + fo.putbchars = sprint_bchars; + fo.putuchars = sprint_uchars; fo.putobj = moo_fmt_object_; /* format_stack_args doesn't use fmt_str and fmt_type. * it takes the format string from the stack. */ diff --git a/moo/lib/moo-utl.h b/moo/lib/moo-utl.h index 1d409a9..75a3173 100644 --- a/moo/lib/moo-utl.h +++ b/moo/lib/moo-utl.h @@ -301,13 +301,13 @@ typedef enum moo_cmgr_id_t moo_cmgr_id_t; * ========================================================================= */ typedef struct moo_fmtout_t moo_fmtout_t; -typedef int (*moo_fmtout_putbcs_t) ( +typedef int (*moo_fmtout_putbchars_t) ( moo_fmtout_t* fmtout, const moo_bch_t* ptr, moo_oow_t len ); -typedef int (*moo_fmtout_putucs_t) ( +typedef int (*moo_fmtout_putuchars_t) ( moo_fmtout_t* fmtout, const moo_uch_t* ptr, moo_oow_t len @@ -328,16 +328,16 @@ typedef enum moo_fmtout_fmt_type_t moo_fmtout_fmt_type_t; struct moo_fmtout_t { - moo_oow_t count; /* out */ + moo_oow_t count; /* out */ - moo_fmtout_putbcs_t putbcs; /* in */ - moo_fmtout_putucs_t putucs; /* in */ - moo_fmtout_putobj_t putobj; /* in - %O is not handled if it's not set. */ - moo_bitmask_t mask; /* in */ - void* ctx; /* in */ + moo_fmtout_putbchars_t putbchars; /* in */ + moo_fmtout_putuchars_t putuchars; /* in */ + moo_fmtout_putobj_t putobj; /* in - %O is not handled if it's not set. */ + moo_bitmask_t mask; /* in */ + void* ctx; /* in */ - moo_fmtout_fmt_type_t fmt_type; - const void* fmt_str; + moo_fmtout_fmt_type_t fmt_type; + const void* fmt_str; };