refactored code a little bit

This commit is contained in:
hyung-hwan 2017-09-13 14:04:01 +00:00
parent 936426de42
commit aa6a41c009
4 changed files with 12 additions and 29 deletions

View File

@ -443,9 +443,8 @@ static int xli_main (int argc, qse_char_t* argv[])
if (n <= -1)
{
const qse_xli_loc_t* errloc;
errloc = qse_xli_geterrloc (xli);
errloc = qse_xli_geterrloc (xli);
if (errloc->line > 0 || errloc->colm > 0)
{
qse_fprintf (QSE_STDERR,
@ -539,13 +538,12 @@ static int xli_main (int argc, qse_char_t* argv[])
out.type = QSE_XLI_IOSTD_FILE;
out.u.file.path = QSE_T("-");
out.u.file.cmgr = g_outfile_cmgr;
qse_xli_writestd (xli, pair->val, &out);
qse_xli_writestd (xli, (qse_xli_list_t*)pair->val, &out);
}
}
}
}
out.type = QSE_XLI_IOSTD_FILE;
out.u.file.path = g_output_file? g_output_file: QSE_T("-");
out.u.file.cmgr = g_outfile_cmgr;

View File

@ -58,7 +58,7 @@ LT_CONFIG_LTDL_DIR([libltdl])
save_CFLAGS="$CFLAGS"
save_LDFLAGS="$LDFLAGS"
save_LIBS="$LIBS"
LTDL_INIT
LTDL_INIT(convenience)
LDFLAGS="$save_LDFLAGS"
CFLAGS="$save_CFLAGS"
LIBS="$save_LIBS"

View File

@ -291,8 +291,6 @@ qse_size_t qse_wcsupr (qse_wchar_t* str)
return p - str;
}
/*---------------------------------------------------------------
* Hexadecimal string conversion
*---------------------------------------------------------------*/
@ -306,21 +304,15 @@ int qse_mbshextobin (const qse_mchar_t* hex, qse_size_t hexlen, qse_uint8_t* buf
{
int v;
if (*hex >= QSE_MT('0') && *hex <= QSE_MT('9')) v = *hex - QSE_MT('0');
else if (*hex >= QSE_MT('a') && *hex <= QSE_MT('f')) v = *hex - QSE_MT('a') + 10;
else if (*hex >= QSE_MT('A') && *hex <= QSE_MT('F')) v = *hex - QSE_MT('A') + 10;
else return -1;
v = QSE_MXDIGITTONUM(*hex);
if (v <= -1) return -1;
buf[bi] = buf[bi] * 16 + v;
hex++;
if (hex >= end) return -1;
if (*hex >= QSE_MT('0') && *hex <= QSE_MT('9')) v = *hex - QSE_MT('0');
else if (*hex >= QSE_MT('a') && *hex <= QSE_MT('f')) v = *hex - QSE_MT('a') + 10;
else if (*hex >= QSE_MT('A') && *hex <= QSE_MT('F')) v = *hex - QSE_MT('A') + 10;
else return -1;
v = QSE_MXDIGITTONUM(*hex);
if (v <= -1) return -1;
buf[bi] = buf[bi] * 16 + v;
hex++;
@ -330,7 +322,6 @@ int qse_mbshextobin (const qse_mchar_t* hex, qse_size_t hexlen, qse_uint8_t* buf
return 0;
}
int qse_wcshextobin (const qse_wchar_t* hex, qse_size_t hexlen, qse_uint8_t* buf, qse_size_t buflen)
{
const qse_wchar_t* end = hex + hexlen;
@ -340,21 +331,15 @@ int qse_wcshextobin (const qse_wchar_t* hex, qse_size_t hexlen, qse_uint8_t* buf
{
int v;
if (*hex >= QSE_WT('0') && *hex <= QSE_WT('9')) v = *hex - QSE_WT('0');
else if (*hex >= QSE_WT('a') && *hex <= QSE_WT('f')) v = *hex - QSE_WT('a') + 10;
else if (*hex >= QSE_WT('A') && *hex <= QSE_WT('F')) v = *hex - QSE_WT('A') + 10;
else return -1;
v = QSE_WXDIGITTONUM(*hex);
if (v <= -1) return -1;
buf[bi] = buf[bi] * 16 + v;
hex++;
if (hex >= end) return -1;
if (*hex >= QSE_WT('0') && *hex <= QSE_WT('9')) v = *hex - QSE_WT('0');
else if (*hex >= QSE_WT('a') && *hex <= QSE_WT('f')) v = *hex - QSE_WT('a') + 10;
else if (*hex >= QSE_WT('A') && *hex <= QSE_WT('F')) v = *hex - QSE_WT('A') + 10;
else return -1;
v = QSE_WXDIGITTONUM(*hex);
if (v <= -1) return -1;
buf[bi] = buf[bi] * 16 + v;
hex++;

View File

@ -91,7 +91,7 @@ static int write_list (qse_xli_t* xli, qse_xli_list_t* list, int depth)
{
/* key = value is not supported at the top level */
if (write_to_current_stream (xli, QSE_T(" = "), 3) <= -1) return -1;
if (write_to_current_stream (xli, QSE_T("="), 1) <= -1) return -1;
while (1)
{
if (str->tag)