added hcl_fill_uchars()/hcl_fill_bchars()

This commit is contained in:
hyung-hwan 2019-02-18 17:18:21 +00:00
parent fe81119228
commit b39ce631b3
2 changed files with 26 additions and 0 deletions

View File

@ -257,6 +257,18 @@ HCL_EXPORT hcl_oow_t hcl_copy_bcstr (
const hcl_bch_t* src
);
HCL_EXPORT void hcl_fill_uchars (
hcl_uch_t* dst,
const hcl_uch_t ch,
hcl_oow_t len
);
HCL_EXPORT void hcl_fill_bchars (
hcl_bch_t* dst,
const hcl_bch_t ch,
hcl_oow_t len
);
HCL_EXPORT hcl_uch_t* hcl_find_uchar (
const hcl_uch_t* ptr,
hcl_oow_t len,
@ -310,6 +322,7 @@ HCL_EXPORT hcl_oow_t hcl_count_bcstr (
# define hcl_copy_oochars(dst,src,len) hcl_copy_uchars(dst,src,len)
# define hcl_copy_bchars_to_oochars(dst,src,len) hcl_copy_bchars_to_uchars(dst,src,len)
# define hcl_copy_oocstr(dst,len,src) hcl_copy_ucstr(dst,len,src)
# define hcl_fill_oochars(dst,ch,len) hcl_fill_uchars(dst,ch,len)
# define hcl_find_oochar(ptr,len,c) hcl_find_uchar(ptr,len,c)
# define hcl_rfind_oochar(ptr,len,c) hcl_rfind_uchar(ptr,len,c)
# define hcl_find_oochar_in_oocstr(ptr,c) hcl_find_uchar_in_ucstr(ptr,c)
@ -325,6 +338,7 @@ HCL_EXPORT hcl_oow_t hcl_count_bcstr (
# define hcl_copy_oochars(dst,src,len) hcl_copy_bchars(dst,src,len)
# define hcl_copy_bchars_to_oochars(dst,src,len) hcl_copy_bchars(dst,src,len)
# define hcl_copy_oocstr(dst,len,src) hcl_copy_bcstr(dst,len,src)
# define hcl_fill_oochars(dst,ch,len) hcl_fill_bchars(dst,ch,len)
# define hcl_find_oochar(ptr,len,c) hcl_find_bchar(ptr,len,c)
# define hcl_rfind_oochar(ptr,len,c) hcl_rfind_bchar(ptr,len,c)
# define hcl_find_oochar_in_oocstr(ptr,c) hcl_find_bchar_in_bcstr(ptr,c)

View File

@ -257,6 +257,18 @@ hcl_oow_t hcl_copy_bcstr (hcl_bch_t* dst, hcl_oow_t len, const hcl_bch_t* src)
return p - dst;
}
void hcl_fill_uchars (hcl_uch_t* dst, hcl_uch_t ch, hcl_oow_t len)
{
hcl_oow_t i;
for (i = 0; i < len; i++) dst[i] = ch;
}
void hcl_fill_bchars (hcl_bch_t* dst, hcl_bch_t ch, hcl_oow_t len)
{
hcl_oow_t i;
for (i = 0; i < len; i++) dst[i] = ch;
}
hcl_oow_t hcl_count_ucstr (const hcl_uch_t* str)
{
const hcl_uch_t* ptr = str;