renamed some types and variables for consistency
This commit is contained in:
parent
925f70fea6
commit
8bf6b40d49
@ -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;
|
||||
|
||||
|
@ -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. */
|
||||
|
@ -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
|
||||
@ -330,8 +330,8 @@ struct moo_fmtout_t
|
||||
{
|
||||
moo_oow_t count; /* out */
|
||||
|
||||
moo_fmtout_putbcs_t putbcs; /* in */
|
||||
moo_fmtout_putucs_t putucs; /* 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 */
|
||||
|
Loading…
Reference in New Issue
Block a user