removed unnecessary code in some initialization code.
added errnum to some open functions
This commit is contained in:
parent
7675a86234
commit
26440f1a96
@ -2282,7 +2282,7 @@ static int open_config_file (qse_httpd_t* httpd)
|
|||||||
httpd_xtn = (httpd_xtn_t*) qse_httpd_getxtnstd (httpd);
|
httpd_xtn = (httpd_xtn_t*) qse_httpd_getxtnstd (httpd);
|
||||||
QSE_ASSERT (httpd_xtn->xli == QSE_NULL);
|
QSE_ASSERT (httpd_xtn->xli == QSE_NULL);
|
||||||
|
|
||||||
httpd_xtn->xli = qse_xli_openstd (0, 0);
|
httpd_xtn->xli = qse_xli_openstd (0, 0, QSE_NULL);
|
||||||
if (httpd_xtn->xli == QSE_NULL)
|
if (httpd_xtn->xli == QSE_NULL)
|
||||||
{
|
{
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("Cannot open xli\n"));
|
qse_fprintf (QSE_STDERR, QSE_T("Cannot open xli\n"));
|
||||||
@ -2710,7 +2710,7 @@ static int httpd_main (int argc, qse_char_t* argv[])
|
|||||||
if (ret <= -1) return -1;
|
if (ret <= -1) return -1;
|
||||||
if (ret == 0) return 0;
|
if (ret == 0) return 0;
|
||||||
|
|
||||||
httpd = qse_httpd_openstd (QSE_SIZEOF(httpd_xtn_t));
|
httpd = qse_httpd_openstd (QSE_SIZEOF(httpd_xtn_t), QSE_NULL);
|
||||||
if (httpd == QSE_NULL)
|
if (httpd == QSE_NULL)
|
||||||
{
|
{
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: Cannot open httpd\n"));
|
qse_fprintf (QSE_STDERR, QSE_T("ERROR: Cannot open httpd\n"));
|
||||||
|
@ -754,8 +754,8 @@ static int sed_main (int argc, qse_char_t* argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sed = qse_sed_openstdwithmmgr (mmgr, 0);
|
sed = qse_sed_openstdwithmmgr (mmgr, 0, QSE_NULL);
|
||||||
if (sed == QSE_NULL)
|
if (!sed)
|
||||||
{
|
{
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open stream editor\n"));
|
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open stream editor\n"));
|
||||||
goto oops;
|
goto oops;
|
||||||
|
@ -395,7 +395,7 @@ static int xli_main (int argc, qse_char_t* argv[])
|
|||||||
mmgr = &xma_mmgr;
|
mmgr = &xma_mmgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
xli = qse_xli_openstdwithmmgr (mmgr, 0, 0);
|
xli = qse_xli_openstdwithmmgr (mmgr, 0, 0, QSE_NULL);
|
||||||
if (xli == QSE_NULL)
|
if (xli == QSE_NULL)
|
||||||
{
|
{
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open stream editor\n"));
|
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open stream editor\n"));
|
||||||
|
@ -1054,8 +1054,9 @@ extern "C" {
|
|||||||
* The qse_httpd_open() function creates a httpd processor.
|
* The qse_httpd_open() function creates a httpd processor.
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT qse_httpd_t* qse_httpd_open (
|
QSE_EXPORT qse_httpd_t* qse_httpd_open (
|
||||||
qse_mmgr_t* mmgr, /**< memory manager */
|
qse_mmgr_t* mmgr, /**< memory manager */
|
||||||
qse_size_t xtnsize /**< extension size in bytes */
|
qse_size_t xtnsize, /**< extension size in bytes */
|
||||||
|
qse_httpd_errnum_t* errnum
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -223,12 +223,14 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QSE_EXPORT qse_httpd_t* qse_httpd_openstd (
|
QSE_EXPORT qse_httpd_t* qse_httpd_openstd (
|
||||||
qse_size_t xtnsize
|
qse_size_t xtnsize,
|
||||||
|
qse_httpd_errnum_t* errnum
|
||||||
);
|
);
|
||||||
|
|
||||||
QSE_EXPORT qse_httpd_t* qse_httpd_openstdwithmmgr (
|
QSE_EXPORT qse_httpd_t* qse_httpd_openstdwithmmgr (
|
||||||
qse_mmgr_t* mmgr,
|
qse_mmgr_t* mmgr,
|
||||||
qse_size_t xtnsize
|
qse_size_t xtnsize,
|
||||||
|
qse_httpd_errnum_t* errnum
|
||||||
);
|
);
|
||||||
|
|
||||||
QSE_EXPORT void* qse_httpd_getxtnstd (
|
QSE_EXPORT void* qse_httpd_getxtnstd (
|
||||||
|
@ -424,8 +424,9 @@ extern "C" {
|
|||||||
* @return pointer to a stream editor on success, QSE_NULL on failure
|
* @return pointer to a stream editor on success, QSE_NULL on failure
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT qse_sed_t* qse_sed_open (
|
QSE_EXPORT qse_sed_t* qse_sed_open (
|
||||||
qse_mmgr_t* mmgr, /**< memory manager */
|
qse_mmgr_t* mmgr, /**< memory manager */
|
||||||
qse_size_t xtnsize /**< extension size in bytes */
|
qse_size_t xtnsize, /**< extension size in bytes */
|
||||||
|
qse_sed_errnum_t* errnum
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,7 +108,8 @@ extern "C" {
|
|||||||
* \return pointer to a stream editor on success, #QSE_NULL on failure.
|
* \return pointer to a stream editor on success, #QSE_NULL on failure.
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT qse_sed_t* qse_sed_openstd (
|
QSE_EXPORT qse_sed_t* qse_sed_openstd (
|
||||||
qse_size_t xtnsize /**< extension size in bytes */
|
qse_size_t xtnsize, /**< extension size in bytes */
|
||||||
|
qse_sed_errnum_t* errnum
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,8 +120,9 @@ QSE_EXPORT qse_sed_t* qse_sed_openstd (
|
|||||||
* \return pointer to a stream editor on success, #QSE_NULL on failure.
|
* \return pointer to a stream editor on success, #QSE_NULL on failure.
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT qse_sed_t* qse_sed_openstdwithmmgr (
|
QSE_EXPORT qse_sed_t* qse_sed_openstdwithmmgr (
|
||||||
qse_mmgr_t* mmgr, /**< memory manager */
|
qse_mmgr_t* mmgr, /**< memory manager */
|
||||||
qse_size_t xtnsize /**< extension size in bytes */
|
qse_size_t xtnsize, /**< extension size in bytes */
|
||||||
|
qse_sed_errnum_t* errnum
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,8 +97,10 @@ extern "C" {
|
|||||||
* over qse_xli_open() if you don't need finer-grained customization.
|
* over qse_xli_open() if you don't need finer-grained customization.
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT qse_xli_t* qse_xli_openstd (
|
QSE_EXPORT qse_xli_t* qse_xli_openstd (
|
||||||
qse_size_t xtnsize, /**< extension size in bytes */
|
qse_size_t xtnsize, /**< extension size in bytes */
|
||||||
qse_size_t rootxtnsize /**< extension size in bytes for the root list node */
|
qse_size_t rootxtnsize, /**< extension size in bytes for the root list node */
|
||||||
|
qse_xli_errnum_t* errnum
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,9 +109,10 @@ QSE_EXPORT qse_xli_t* qse_xli_openstd (
|
|||||||
* except that you can specify your own memory manager.
|
* except that you can specify your own memory manager.
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT qse_xli_t* qse_xli_openstdwithmmgr (
|
QSE_EXPORT qse_xli_t* qse_xli_openstdwithmmgr (
|
||||||
qse_mmgr_t* mmgr, /**< memory manager */
|
qse_mmgr_t* mmgr, /**< memory manager */
|
||||||
qse_size_t xtnsize, /**< extension size in bytes */
|
qse_size_t xtnsize, /**< extension size in bytes */
|
||||||
qse_size_t rootxtnsize /**< extension size in bytes for the root list node */
|
qse_size_t rootxtnsize, /**< extension size in bytes for the root list node */
|
||||||
|
qse_xli_errnum_t* errnum
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -392,16 +392,16 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QSE_EXPORT qse_xli_t* qse_xli_open (
|
QSE_EXPORT qse_xli_t* qse_xli_open (
|
||||||
qse_mmgr_t* mmgr,
|
qse_mmgr_t* mmgr,
|
||||||
qse_size_t xtnsize,
|
qse_size_t xtnsize,
|
||||||
qse_size_t rootxtnsize
|
qse_size_t rootxtnsize,
|
||||||
|
qse_xli_errnum_t* errnum
|
||||||
);
|
);
|
||||||
|
|
||||||
QSE_EXPORT void qse_xli_close (
|
QSE_EXPORT void qse_xli_close (
|
||||||
qse_xli_t* xli
|
qse_xli_t* xli
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
QSE_EXPORT qse_mmgr_t* qse_xli_getmmgr (
|
QSE_EXPORT qse_mmgr_t* qse_xli_getmmgr (
|
||||||
qse_xli_t* xli
|
qse_xli_t* xli
|
||||||
);
|
);
|
||||||
|
@ -1146,7 +1146,7 @@ int Awk::open ()
|
|||||||
|
|
||||||
qse_awk_errnum_t errnum;
|
qse_awk_errnum_t errnum;
|
||||||
this->awk = qse_awk_open (this->getMmgr(), QSE_SIZEOF(xtn_t), &prm, &errnum);
|
this->awk = qse_awk_open (this->getMmgr(), QSE_SIZEOF(xtn_t), &prm, &errnum);
|
||||||
if (this->awk == QSE_NULL)
|
if (!this->awk)
|
||||||
{
|
{
|
||||||
this->setError (errnum);
|
this->setError (errnum);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -94,7 +94,7 @@ static int fnc_file_to_file (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
|||||||
|
|
||||||
/* result = sed::file_to_file ("s/ABC/123/g", input_file, output_file [, option_string]) */
|
/* result = sed::file_to_file ("s/ABC/123/g", input_file, output_file [, option_string]) */
|
||||||
|
|
||||||
sed = qse_sed_openstdwithmmgr (qse_awk_rtx_getmmgr(rtx), 0);
|
sed = qse_sed_openstdwithmmgr (qse_awk_rtx_getmmgr(rtx), 0, QSE_NULL);
|
||||||
if (sed == QSE_NULL)
|
if (sed == QSE_NULL)
|
||||||
{
|
{
|
||||||
ret = -2;
|
ret = -2;
|
||||||
@ -150,7 +150,7 @@ static int fnc_str_to_str (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
|
|||||||
qse_cstr_t outstr;
|
qse_cstr_t outstr;
|
||||||
int i = 0, ret = 0, n;
|
int i = 0, ret = 0, n;
|
||||||
|
|
||||||
sed = qse_sed_openstdwithmmgr (qse_awk_rtx_getmmgr(rtx), 0);
|
sed = qse_sed_openstdwithmmgr (qse_awk_rtx_getmmgr(rtx), 0, QSE_NULL);
|
||||||
if (sed == QSE_NULL)
|
if (sed == QSE_NULL)
|
||||||
{
|
{
|
||||||
ret = -2;
|
ret = -2;
|
||||||
|
@ -454,7 +454,8 @@ qse_awk_t* qse_awk_openstdwithmmgr (qse_mmgr_t* mmgr, qse_size_t xtnsize, qse_aw
|
|||||||
|
|
||||||
/* initialize extension */
|
/* initialize extension */
|
||||||
xtn = (xtn_t*) QSE_XTN (awk);
|
xtn = (xtn_t*) QSE_XTN (awk);
|
||||||
QSE_MEMSET (xtn, 0, QSE_SIZEOF(*xtn));
|
/* the extension area has been cleared in qse_awk_open().
|
||||||
|
* QSE_MEMSET (xtn, 0, QSE_SIZEOF(*xtn));*/
|
||||||
|
|
||||||
/* add intrinsic global variables and functions */
|
/* add intrinsic global variables and functions */
|
||||||
if (add_globals(awk) <= -1 ||
|
if (add_globals(awk) <= -1 ||
|
||||||
|
@ -739,12 +739,12 @@ static void cleanup_standard_httpd (qse_httpd_t* httpd)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_httpd_t* qse_httpd_openstd (qse_size_t xtnsize)
|
qse_httpd_t* qse_httpd_openstd (qse_size_t xtnsize, qse_httpd_errnum_t* errnum)
|
||||||
{
|
{
|
||||||
return qse_httpd_openstdwithmmgr (QSE_MMGR_GETDFL(), xtnsize);
|
return qse_httpd_openstdwithmmgr (QSE_MMGR_GETDFL(), xtnsize, errnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_httpd_t* qse_httpd_openstdwithmmgr (qse_mmgr_t* mmgr, qse_size_t xtnsize)
|
qse_httpd_t* qse_httpd_openstdwithmmgr (qse_mmgr_t* mmgr, qse_size_t xtnsize, qse_httpd_errnum_t* errnum)
|
||||||
{
|
{
|
||||||
qse_httpd_t* httpd = QSE_NULL;
|
qse_httpd_t* httpd = QSE_NULL;
|
||||||
httpd_xtn_t* xtn = QSE_NULL;
|
httpd_xtn_t* xtn = QSE_NULL;
|
||||||
@ -752,11 +752,12 @@ qse_httpd_t* qse_httpd_openstdwithmmgr (qse_mmgr_t* mmgr, qse_size_t xtnsize)
|
|||||||
int lt_dlinited = 0;
|
int lt_dlinited = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
httpd = qse_httpd_open (mmgr, QSE_SIZEOF(httpd_xtn_t) + xtnsize);
|
httpd = qse_httpd_open (mmgr, QSE_SIZEOF(httpd_xtn_t) + xtnsize, errnum);
|
||||||
if (httpd == QSE_NULL) goto oops;
|
if (httpd == QSE_NULL) goto oops;
|
||||||
|
|
||||||
xtn = (httpd_xtn_t*)qse_httpd_getxtn (httpd);
|
xtn = (httpd_xtn_t*)qse_httpd_getxtn (httpd);
|
||||||
QSE_MEMSET (xtn, 0, QSE_SIZEOF(*xtn));
|
/* the extension area has been cleared in qse_httpd_open().
|
||||||
|
* QSE_MEMSET (xtn, 0, QSE_SIZEOF(*xtn));*/
|
||||||
|
|
||||||
#if defined(USE_LTDL)
|
#if defined(USE_LTDL)
|
||||||
/* lt_dlinit() can be called more than once and
|
/* lt_dlinit() can be called more than once and
|
||||||
|
@ -69,7 +69,7 @@ static void unload_all_modules (qse_httpd_t* httpd);
|
|||||||
|
|
||||||
qse_http_version_t qse_http_v11 = { 1, 1 };
|
qse_http_version_t qse_http_v11 = { 1, 1 };
|
||||||
|
|
||||||
qse_httpd_t* qse_httpd_open (qse_mmgr_t* mmgr, qse_size_t xtnsize)
|
qse_httpd_t* qse_httpd_open (qse_mmgr_t* mmgr, qse_size_t xtnsize, qse_httpd_errnum_t* errnum)
|
||||||
{
|
{
|
||||||
qse_httpd_t* httpd;
|
qse_httpd_t* httpd;
|
||||||
|
|
||||||
@ -78,11 +78,13 @@ qse_httpd_t* qse_httpd_open (qse_mmgr_t* mmgr, qse_size_t xtnsize)
|
|||||||
{
|
{
|
||||||
if (qse_httpd_init (httpd, mmgr) <= -1)
|
if (qse_httpd_init (httpd, mmgr) <= -1)
|
||||||
{
|
{
|
||||||
|
if (errnum) *errnum = qse_httpd_geterrnum(httpd);
|
||||||
QSE_MMGR_FREE (mmgr, httpd);
|
QSE_MMGR_FREE (mmgr, httpd);
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
}
|
}
|
||||||
else QSE_MEMSET (QSE_XTN(httpd), 0, xtnsize);
|
else QSE_MEMSET (QSE_XTN(httpd), 0, xtnsize);
|
||||||
}
|
}
|
||||||
|
else if (errnum) *errnum = QSE_HTTPD_ENOMEM;
|
||||||
|
|
||||||
return httpd;
|
return httpd;
|
||||||
}
|
}
|
||||||
|
@ -35,11 +35,16 @@ QSE_BEGIN_NAMESPACE(QSE)
|
|||||||
|
|
||||||
int Sed::open ()
|
int Sed::open ()
|
||||||
{
|
{
|
||||||
sed = qse_sed_open (this->getMmgr(), QSE_SIZEOF(Sed*));
|
qse_sed_errnum_t errnum;
|
||||||
if (!sed) return -1;
|
this->sed = qse_sed_open (this->getMmgr(), QSE_SIZEOF(Sed*), &errnum);
|
||||||
*(Sed**)QSE_XTN(sed) = this;
|
if (!this->sed)
|
||||||
|
{
|
||||||
|
this->setError (errnum);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
*(Sed**)QSE_XTN(this->sed) = this;
|
||||||
|
|
||||||
dflerrstr = qse_sed_geterrstr (sed);
|
dflerrstr = qse_sed_geterrstr (this->sed);
|
||||||
qse_sed_seterrstr (sed, xerrstr);
|
qse_sed_seterrstr (sed, xerrstr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -63,7 +63,7 @@ do { \
|
|||||||
|
|
||||||
static void free_all_cut_selector_blocks (qse_sed_t* sed, qse_sed_cmd_t* cmd);
|
static void free_all_cut_selector_blocks (qse_sed_t* sed, qse_sed_cmd_t* cmd);
|
||||||
|
|
||||||
qse_sed_t* qse_sed_open (qse_mmgr_t* mmgr, qse_size_t xtnsize)
|
qse_sed_t* qse_sed_open (qse_mmgr_t* mmgr, qse_size_t xtnsize, qse_sed_errnum_t* errnum)
|
||||||
{
|
{
|
||||||
qse_sed_t* sed;
|
qse_sed_t* sed;
|
||||||
|
|
||||||
@ -72,11 +72,13 @@ qse_sed_t* qse_sed_open (qse_mmgr_t* mmgr, qse_size_t xtnsize)
|
|||||||
{
|
{
|
||||||
if (qse_sed_init (sed, mmgr) <= -1)
|
if (qse_sed_init (sed, mmgr) <= -1)
|
||||||
{
|
{
|
||||||
|
if (errnum) *errnum = qse_sed_geterrnum(sed);
|
||||||
QSE_MMGR_FREE (mmgr, sed);
|
QSE_MMGR_FREE (mmgr, sed);
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
}
|
}
|
||||||
else QSE_MEMSET (QSE_XTN(sed), 0, xtnsize);
|
else QSE_MEMSET (QSE_XTN(sed), 0, xtnsize);
|
||||||
}
|
}
|
||||||
|
else if (errnum) *errnum = QSE_SED_ENOMEM;
|
||||||
|
|
||||||
return sed;
|
return sed;
|
||||||
}
|
}
|
||||||
|
@ -100,24 +100,14 @@ static int int_to_str (qse_size_t val, qse_char_t* buf, qse_size_t buflen)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_sed_t* qse_sed_openstd (qse_size_t xtnsize)
|
qse_sed_t* qse_sed_openstd (qse_size_t xtnsize, qse_sed_errnum_t* errnum)
|
||||||
{
|
{
|
||||||
return qse_sed_openstdwithmmgr (QSE_MMGR_GETDFL(), xtnsize);
|
return qse_sed_openstdwithmmgr (QSE_MMGR_GETDFL(), xtnsize, errnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_sed_t* qse_sed_openstdwithmmgr (qse_mmgr_t* mmgr, qse_size_t xtnsize)
|
qse_sed_t* qse_sed_openstdwithmmgr (qse_mmgr_t* mmgr, qse_size_t xtnsize, qse_sed_errnum_t* errnum)
|
||||||
{
|
{
|
||||||
qse_sed_t* sed;
|
return qse_sed_open (mmgr, QSE_SIZEOF(xtn_t) + xtnsize, errnum);
|
||||||
xtn_t* xtn;
|
|
||||||
|
|
||||||
sed = qse_sed_open (mmgr, QSE_SIZEOF(xtn_t) + xtnsize);
|
|
||||||
if (!sed) return QSE_NULL;
|
|
||||||
|
|
||||||
/* initialize the my own extension area excluding xtnsize */
|
|
||||||
xtn = (xtn_t*) QSE_XTN(sed);
|
|
||||||
QSE_MEMSET (xtn, 0, QSE_SIZEOF(*xtn));
|
|
||||||
|
|
||||||
return sed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void* qse_sed_getxtnstd (qse_sed_t* sed)
|
void* qse_sed_getxtnstd (qse_sed_t* sed)
|
||||||
|
@ -71,9 +71,9 @@ typedef struct xtn_t
|
|||||||
qse_xli_ecb_t ecb;
|
qse_xli_ecb_t ecb;
|
||||||
} xtn_t;
|
} xtn_t;
|
||||||
|
|
||||||
qse_xli_t* qse_xli_openstd (qse_size_t xtnsize, qse_size_t rootxtnsize)
|
qse_xli_t* qse_xli_openstd (qse_size_t xtnsize, qse_size_t rootxtnsize, qse_xli_errnum_t* errnum)
|
||||||
{
|
{
|
||||||
return qse_xli_openstdwithmmgr (QSE_MMGR_GETDFL(), xtnsize, rootxtnsize);
|
return qse_xli_openstdwithmmgr (QSE_MMGR_GETDFL(), xtnsize, rootxtnsize, errnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fini_xtn (qse_xli_t* xli)
|
static void fini_xtn (qse_xli_t* xli)
|
||||||
@ -86,18 +86,19 @@ static void clear_xtn (qse_xli_t* xli)
|
|||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_xli_t* qse_xli_openstdwithmmgr (qse_mmgr_t* mmgr, qse_size_t xtnsize, qse_size_t rootxtnsize)
|
qse_xli_t* qse_xli_openstdwithmmgr (qse_mmgr_t* mmgr, qse_size_t xtnsize, qse_size_t rootxtnsize, qse_xli_errnum_t* errnum)
|
||||||
{
|
{
|
||||||
qse_xli_t* xli;
|
qse_xli_t* xli;
|
||||||
xtn_t* xtn;
|
xtn_t* xtn;
|
||||||
|
|
||||||
/* create an object */
|
/* create an object */
|
||||||
xli = qse_xli_open (mmgr, QSE_SIZEOF(xtn_t) + xtnsize, rootxtnsize);
|
xli = qse_xli_open (mmgr, QSE_SIZEOF(xtn_t) + xtnsize, rootxtnsize, errnum);
|
||||||
if (xli == QSE_NULL) goto oops;
|
if (xli == QSE_NULL) goto oops;
|
||||||
|
|
||||||
/* initialize extension */
|
/* initialize extension */
|
||||||
xtn = (xtn_t*) QSE_XTN (xli);
|
xtn = (xtn_t*) QSE_XTN (xli);
|
||||||
QSE_MEMSET (xtn, 0, QSE_SIZEOF(*xtn));
|
/* the extension area has been cleared in qse_httpd_open().
|
||||||
|
* QSE_MEMSET (xtn, 0, QSE_SIZEOF(*xtn));*/
|
||||||
|
|
||||||
xtn->ecb.close = fini_xtn;
|
xtn->ecb.close = fini_xtn;
|
||||||
xtn->ecb.clear = clear_xtn;
|
xtn->ecb.clear = clear_xtn;
|
||||||
|
@ -32,7 +32,7 @@ static void free_val (qse_xli_root_list_t* xli, qse_xli_val_t* val);
|
|||||||
static void free_list (qse_xli_root_list_t* xli, qse_xli_list_t* list);
|
static void free_list (qse_xli_root_list_t* xli, qse_xli_list_t* list);
|
||||||
static void free_atom (qse_xli_root_list_t* xli, qse_xli_atom_t* atom);
|
static void free_atom (qse_xli_root_list_t* xli, qse_xli_atom_t* atom);
|
||||||
|
|
||||||
qse_xli_t* qse_xli_open (qse_mmgr_t* mmgr, qse_size_t xtnsize, qse_size_t rootxtnsize)
|
qse_xli_t* qse_xli_open (qse_mmgr_t* mmgr, qse_size_t xtnsize, qse_size_t rootxtnsize, qse_xli_errnum_t* errnum)
|
||||||
{
|
{
|
||||||
qse_xli_t* xli;
|
qse_xli_t* xli;
|
||||||
|
|
||||||
@ -41,11 +41,13 @@ qse_xli_t* qse_xli_open (qse_mmgr_t* mmgr, qse_size_t xtnsize, qse_size_t rootxt
|
|||||||
{
|
{
|
||||||
if (qse_xli_init (xli, mmgr, rootxtnsize) <= -1)
|
if (qse_xli_init (xli, mmgr, rootxtnsize) <= -1)
|
||||||
{
|
{
|
||||||
|
if (errnum) *errnum = qse_xli_geterrnum(xli);
|
||||||
QSE_MMGR_FREE (mmgr, xli);
|
QSE_MMGR_FREE (mmgr, xli);
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
}
|
}
|
||||||
else QSE_MEMSET (QSE_XTN(xli), 0, xtnsize);
|
else QSE_MEMSET (QSE_XTN(xli), 0, xtnsize);
|
||||||
}
|
}
|
||||||
|
else if (errnum) *errnum = QSE_XLI_ENOMEM;
|
||||||
|
|
||||||
return xli;
|
return xli;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ static int sed_main (int argc, qse_char_t* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create a sed object */
|
/* create a sed object */
|
||||||
sed = qse_sed_openstd (0);
|
sed = qse_sed_openstd (0, QSE_NULL);
|
||||||
if (sed == QSE_NULL)
|
if (sed == QSE_NULL)
|
||||||
{
|
{
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open sed\n"));
|
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open sed\n"));
|
||||||
|
@ -17,7 +17,7 @@ static int sed_main (int argc, qse_char_t* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create the sed object */
|
/* create the sed object */
|
||||||
sed = qse_sed_openstd (0);
|
sed = qse_sed_openstd (0, QSE_NULL);
|
||||||
if (sed == QSE_NULL)
|
if (sed == QSE_NULL)
|
||||||
{
|
{
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open sed\n"));
|
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open sed\n"));
|
||||||
|
@ -23,7 +23,7 @@ static int sed_main (int argc, qse_char_t* argv[])
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
/* create the sed object */
|
/* create the sed object */
|
||||||
sed = qse_sed_openstd (0);
|
sed = qse_sed_openstd (0, QSE_NULL);
|
||||||
if (sed == QSE_NULL)
|
if (sed == QSE_NULL)
|
||||||
{
|
{
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open sed\n"));
|
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open sed\n"));
|
||||||
|
Loading…
Reference in New Issue
Block a user