From c42a9945b12896e031412056e5388631eccf1808 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 26 Oct 2015 16:40:09 +0000 Subject: [PATCH] changed to use lt_dlopenadvise() instead of lt_dlopenext() --- qse/doc/page/awk-lang.md | 2 +- qse/lib/awk/std.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/qse/doc/page/awk-lang.md b/qse/doc/page/awk-lang.md index 8217f7fa..e0ef6e53 100644 --- a/qse/doc/page/awk-lang.md +++ b/qse/doc/page/awk-lang.md @@ -210,7 +210,7 @@ this tokenization process. ### Comments ### -A comment is a part of the program text excluded during tokenization. You can +A comment is part of the program text excluded during tokenization. You can put descriptive text about the program in a comment. A single-line comment is introduced by a hash character #, and is terminated at diff --git a/qse/lib/awk/std.c b/qse/lib/awk/std.c index 078459d0..ca818a87 100644 --- a/qse/lib/awk/std.c +++ b/qse/lib/awk/std.c @@ -222,6 +222,7 @@ void* qse_awk_stdmodopen (qse_awk_t* awk, const qse_awk_mod_spec_t* spec) { #if defined(USE_LTDL) void* h; + lt_dladvise adv; qse_mchar_t* modpath; const qse_char_t* tmp[4]; int count; @@ -252,7 +253,20 @@ void* qse_awk_stdmodopen (qse_awk_t* awk, const qse_awk_mod_spec_t* spec) return QSE_NULL; } - h = lt_dlopenext (modpath); + if (lt_dladvise_init (&adv) != 0) + { + /* the only failure of lt_dladvise_init() seems to be caused + * by memory allocation failured */ + qse_awk_seterrnum (awk, QSE_AWK_ENOMEM, QSE_NULL); + return QSE_NULL; + } + + lt_dladvise_ext (&adv); + /*lt_dladvise_resident (&adv); useful for debugging with valgrind */ + + h = lt_dlopenadvise (modpath, adv); + + lt_dladvise_destroy (&adv); QSE_MMGR_FREE (awk->mmgr, modpath);