added mio_fill_uchars()/mio_fill_bchars()

This commit is contained in:
hyung-hwan 2019-02-18 17:15:44 +00:00
parent 0760dc1a04
commit 0f9eac0614
5 changed files with 30 additions and 4 deletions

View File

@ -100,10 +100,10 @@ struct mio_sys_time_t
DWORD tc_overflow; DWORD tc_overflow;
#elif defined(__OS2__) #elif defined(__OS2__)
ULONG tc_last; ULONG tc_last;
moo_ntime_t tc_last_ret; mio_ntime_t tc_last_ret;
#elif defined(__DOS__) #elif defined(__DOS__)
clock_t tc_last; clock_t tc_last;
moo_ntime_t tc_last_ret; mio_ntime_t tc_last_ret;
#else #else
/* nothing */ /* nothing */
#endif #endif

View File

@ -156,6 +156,18 @@ MIO_EXPORT mio_oow_t mio_copy_bcstr (
const mio_bch_t* src const mio_bch_t* src
); );
MIO_EXPORT void mio_fill_uchars (
mio_uch_t* dst,
const mio_uch_t ch,
mio_oow_t len
);
MIO_EXPORT void mio_fill_bchars (
mio_bch_t* dst,
const mio_bch_t ch,
mio_oow_t len
);
MIO_EXPORT mio_uch_t* mio_find_uchar ( MIO_EXPORT mio_uch_t* mio_find_uchar (
const mio_uch_t* ptr, const mio_uch_t* ptr,
mio_oow_t len, mio_oow_t len,
@ -209,6 +221,7 @@ MIO_EXPORT mio_oow_t mio_count_bcstr (
# define mio_copy_oochars(dst,src,len) mio_copy_uchars(dst,src,len) # define mio_copy_oochars(dst,src,len) mio_copy_uchars(dst,src,len)
# define mio_copy_bchars_to_oochars(dst,src,len) mio_copy_bchars_to_uchars(dst,src,len) # define mio_copy_bchars_to_oochars(dst,src,len) mio_copy_bchars_to_uchars(dst,src,len)
# define mio_copy_oocstr(dst,len,src) mio_copy_ucstr(dst,len,src) # define mio_copy_oocstr(dst,len,src) mio_copy_ucstr(dst,len,src)
# define mio_fill_oochars(dst,ch,len) mio_fill_uchars(dst,ch,len)
# define mio_find_oochar(ptr,len,c) mio_find_uchar(ptr,len,c) # define mio_find_oochar(ptr,len,c) mio_find_uchar(ptr,len,c)
# define mio_rfind_oochar(ptr,len,c) mio_rfind_uchar(ptr,len,c) # define mio_rfind_oochar(ptr,len,c) mio_rfind_uchar(ptr,len,c)
# define mio_find_oochar_in_oocstr(ptr,c) mio_find_uchar_in_ucstr(ptr,c) # define mio_find_oochar_in_oocstr(ptr,c) mio_find_uchar_in_ucstr(ptr,c)
@ -224,6 +237,7 @@ MIO_EXPORT mio_oow_t mio_count_bcstr (
# define mio_copy_oochars(dst,src,len) mio_copy_bchars(dst,src,len) # define mio_copy_oochars(dst,src,len) mio_copy_bchars(dst,src,len)
# define mio_copy_bchars_to_oochars(dst,src,len) mio_copy_bchars(dst,src,len) # define mio_copy_bchars_to_oochars(dst,src,len) mio_copy_bchars(dst,src,len)
# define mio_copy_oocstr(dst,len,src) mio_copy_bcstr(dst,len,src) # define mio_copy_oocstr(dst,len,src) mio_copy_bcstr(dst,len,src)
# define mio_fill_oochars(dst,ch,len) mio_fill_bchars(dst,ch,len)
# define mio_find_oochar(ptr,len,c) mio_find_bchar(ptr,len,c) # define mio_find_oochar(ptr,len,c) mio_find_bchar(ptr,len,c)
# define mio_rfind_oochar(ptr,len,c) mio_rfind_bchar(ptr,len,c) # define mio_rfind_oochar(ptr,len,c) mio_rfind_bchar(ptr,len,c)
# define mio_find_oochar_in_oocstr(ptr,c) mio_find_bchar_in_bcstr(ptr,c) # define mio_find_oochar_in_oocstr(ptr,c) mio_find_bchar_in_bcstr(ptr,c)

View File

@ -1271,7 +1271,7 @@ void mio_gettime (mio_t* mio, mio_ntime_t* now)
{ {
mio_sys_gettime (mio, now); mio_sys_gettime (mio, now);
/* in mio_init(), mio->init_time has been set to the initialization time. /* in mio_init(), mio->init_time has been set to the initialization time.
* the time returned here gets offset by moo->init_time and * the time returned here gets offset by mio->init_time and
* thus becomes relative to it. this way, it is kept small such that it * thus becomes relative to it. this way, it is kept small such that it
* can be represented in a small integer with leaving almost zero chance * can be represented in a small integer with leaving almost zero chance
* of overflow. */ * of overflow. */

View File

@ -72,7 +72,7 @@ int mio_sys_ctrlmux (mio_t* mio, mio_sys_mux_cmd_t cmd, mio_dev_t* dev, int dev_
if (cmd != MIO_SYS_MUX_CMD_INSERT) if (cmd != MIO_SYS_MUX_CMD_INSERT)
{ {
mio_seterrnum (moo, MIO_ENOENT); mio_seterrnum (mio, MIO_ENOENT);
return -1; return -1;
} }

View File

@ -550,6 +550,18 @@ mio_oow_t mio_copy_bcstr (mio_bch_t* dst, mio_oow_t len, const mio_bch_t* src)
return p - dst; return p - dst;
} }
void mio_fill_uchars (mio_uch_t* dst, mio_uch_t ch, mio_oow_t len)
{
mio_oow_t i;
for (i = 0; i < len; i++) dst[i] = ch;
}
void mio_fill_bchars (mio_bch_t* dst, mio_bch_t ch, mio_oow_t len)
{
mio_oow_t i;
for (i = 0; i < len; i++) dst[i] = ch;
}
mio_oow_t mio_count_ucstr (const mio_uch_t* str) mio_oow_t mio_count_ucstr (const mio_uch_t* str)
{ {
const mio_uch_t* ptr = str; const mio_uch_t* ptr = str;