[Dev-luatex] [PATCH] Respect find_{output,write}_file result

Marcel Fabian Kr├╝ger tex at 2krueger.de
Sun May 26 21:50:29 CEST 2019


On 5/26/2019 6:34 PM, Hans Hagen wrote:
> indeed a bug but the solution is a bit different as we can avoid going
> via the string pool
> 
> Hans

More like this?
Marcel

---
 source/texk/web2c/luatexdir/tex/texfileio.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/source/texk/web2c/luatexdir/tex/texfileio.c b/source/texk/web2c/luatexdir/tex/texfileio.c
index 143e694e1..5480c30de 100644
--- a/source/texk/web2c/luatexdir/tex/texfileio.c
+++ b/source/texk/web2c/luatexdir/tex/texfileio.c
@@ -332,14 +332,13 @@ boolean lua_a_open_in(alpha_file * f, char *fn, int n)
 boolean lua_a_open_out(alpha_file * f, char *fn, int n)
 {
     boolean test;
-    str_number fnam;
+    const char *fnam;
     int callback_id;
     boolean ret = false;
     callback_id = callback_defined(find_write_file_callback);
     if (callback_id > 0) {
-        fnam = 0;
-        test = run_callback(callback_id, "dS->s", n, fn, &fnam);
-        if ((test) && (fnam != 0) && (str_length(fnam) > 0)) {
+        test = run_callback(callback_id, "dS->R", n, fn, &fnam);
+        if ((test) && (fnam != NULL) && (strlen(fnam) > 0)) {
             /*tex
 
                 There is no message here because if that is needed the macro
@@ -347,7 +346,7 @@ boolean lua_a_open_out(alpha_file * f, char *fn, int n)
                 messaging is left to \LUA\ then.
 
             */
-            ret = open_outfile(f, fn, FOPEN_W_MODE);
+            ret = open_outfile(f, fnam, FOPEN_W_MODE);
         }
     } else {
         if (openoutnameok(fn)) {
@@ -371,15 +370,14 @@ boolean lua_a_open_out(alpha_file * f, char *fn, int n)
 boolean lua_b_open_out(alpha_file * f, char *fn)
 {
     boolean test;
-    str_number fnam;
+    const char *fnam;
     int callback_id;
     boolean ret = false;
     callback_id = callback_defined(find_output_file_callback);
     if (callback_id > 0) {
-        fnam = 0;
-        test = run_callback(callback_id, "S->s", fn, &fnam);
-        if ((test) && (fnam != 0) && (str_length(fnam) > 0)) {
-            ret = open_outfile(f, fn, FOPEN_WBIN_MODE);
+        test = run_callback(callback_id, "S->R", fn, &fnam);
+        if ((test) && (fnam != NULL) && (strlen(fnam) > 0)) {
+            ret = open_outfile(f, fnam, FOPEN_WBIN_MODE);
         }
     } else {
         if (openoutnameok(fn)) {
-- 
2.21.0





More information about the dev-luatex mailing list