minor change in str-dyn.h

This commit is contained in:
hyung-hwan 2019-11-17 16:23:50 +00:00
parent 0cc0de3d7b
commit 049727fd9f
2 changed files with 7 additions and 8 deletions

View File

@ -87,6 +87,7 @@ static int mbs_to_wcs (
#undef cstr_t
#undef str_sizer_t
#undef T
#undef STR_LEN
#undef strlen
#undef strncpy
#undef strxpac
@ -135,6 +136,7 @@ static int mbs_to_wcs (
#define cstr_t qse_mcstr_t
#define str_sizer_t qse_mbs_sizer_t
#define T(x) QSE_MT(x)
#define STR_LEN(x) QSE_MBS_LEN(x)
#define strlen(x) qse_mbslen(x)
#define strncpy(x,y,z) qse_mbsncpy(x,y,z)
#define strxpac(x,y) qse_mbsxpac(x,y)
@ -186,6 +188,7 @@ static int mbs_to_wcs (
#undef cstr_t
#undef str_sizer_t
#undef T
#undef STR_LEN
#undef strlen
#undef strncpy
#undef strxpac
@ -234,6 +237,7 @@ static int mbs_to_wcs (
#define cstr_t qse_wcstr_t
#define str_sizer_t qse_wcs_sizer_t
#define T(x) QSE_WT(x)
#define STR_LEN(x) QSE_WCS_LEN(x)
#define strlen(x) qse_wcslen(x)
#define strncpy(x,y,z) qse_wcsncpy(x,y,z)
#define strxpac(x,y) qse_wcsxpac(x,y)

View File

@ -105,11 +105,7 @@ int str_yield (str_t* str, cstr_t* buf, qse_size_t newcapa)
tmp[0] = T('\0');
}
if (buf != QSE_NULL)
{
buf->ptr = str->val.ptr;
buf->len = str->val.len;
}
if (buf) *buf = str->val;
str->val.ptr = tmp;
str->val.len = 0;
@ -182,7 +178,7 @@ qse_size_t str_setcapa (str_t* str, qse_size_t capa)
qse_size_t str_getlen (str_t* str)
{
return QSE_MBS_LEN (str);
return STR_LEN(str);
}
qse_size_t str_setlen (str_t* str, qse_size_t len)
@ -197,8 +193,7 @@ qse_size_t str_setlen (str_t* str, qse_size_t len)
if (len > str->capa)
{
if (str_setcapa (str, len) == (qse_size_t)-1)
return (qse_size_t)-1;
if (str_setcapa(str, len) == (qse_size_t)-1) return (qse_size_t)-1;
}
while (str->val.len < len) str->val.ptr[str->val.len++] = T(' ');