improved qse_htb_t to use less memory. this resulted in backward-incompatible interface

This commit is contained in:
2010-10-28 06:54:37 +00:00
parent 167449e3f1
commit 81f314d676
9 changed files with 411 additions and 181 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c 344 2010-08-17 13:15:14Z hyunghwan.chung $
* $Id: awk.c 363 2010-10-27 12:54:37Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -431,16 +431,34 @@ static int comparg (int argc, qse_char_t* argv[], struct arg_t* arg)
goto oops;
}
gvm = qse_htb_open (QSE_NULL, 0, 30, 70);
gvm = qse_htb_open (
QSE_NULL, 0, 30, 70,
QSE_SIZEOF(qse_char_t), QSE_SIZEOF(struct gvmv_t)
);
if (gvm == QSE_NULL)
{
print_err (QSE_T("out of memory\n"));
goto oops;
}
/*qse_htb_setcopier (gvm, QSE_HTB_KEY, QSE_HTB_COPIER_INLINE);*/
qse_htb_setscale (gvm, QSE_HTB_KEY, QSE_SIZEOF(qse_char_t));
qse_htb_setcopier (gvm, QSE_HTB_VAL, QSE_HTB_COPIER_INLINE);
qse_htb_setscale (gvm, QSE_HTB_VAL, QSE_SIZEOF(struct gvmv_t));
{
static qse_htb_mancbs_t mancbs =
{
{
QSE_HTB_COPIER_DEFAULT, /* remember the key pointer */
QSE_HTB_COPIER_INLINE /* copy a value inline */
},
{
QSE_HTB_FREEER_DEFAULT,
QSE_HTB_FREEER_DEFAULT
},
QSE_HTB_HASHER_DEFAULT,
QSE_HTB_COMPER_DEFAULT,
QSE_HTB_KEEPER_DEFAULT,
QSE_HTB_SIZER_DEFAULT
};
qse_htb_setmancbs (gvm, &mancbs);
}
while ((c = qse_getopt (argc, argv, &opt)) != QSE_CHAR_EOF)
{