From e6304d3f0b0d72c2f38350d3ae4b4fa6bd862793 Mon Sep 17 00:00:00 2001 From: Luigi Scarso Date: Thu, 8 Feb 2018 09:31:53 +0000 Subject: MFLua 0.9. Fixed a memory leak in runscript. git-svn-id: svn://tug.org/texlive/trunk@46569 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/mfluadir/ChangeLog | 7 +++++++ Build/source/texk/web2c/mfluadir/mf-lua.ch | 25 ++++-------------------- Build/source/texk/web2c/mfluadir/mflua_version.h | 2 +- Build/source/texk/web2c/mfluadir/mfluac.c | 1 - 4 files changed, 12 insertions(+), 23 deletions(-) (limited to 'Build/source') diff --git a/Build/source/texk/web2c/mfluadir/ChangeLog b/Build/source/texk/web2c/mfluadir/ChangeLog index 8721b98acb5..12e941cae46 100644 --- a/Build/source/texk/web2c/mfluadir/ChangeLog +++ b/Build/source/texk/web2c/mfluadir/ChangeLog @@ -1,3 +1,10 @@ +2018-02-08 Luigi Scarso + + * MFLua 0.9. + * Fixed a bug on clean up string in runscript. + + + 2017-04-16 Luigi Scarso * MFLua 0.8. New primitive runscript, cleanup of the Lua code. diff --git a/Build/source/texk/web2c/mfluadir/mf-lua.ch b/Build/source/texk/web2c/mfluadir/mf-lua.ch index 66cc4240b8f..64e04508a33 100644 --- a/Build/source/texk/web2c/mfluadir/mf-lua.ch +++ b/Build/source/texk/web2c/mfluadir/mf-lua.ch @@ -2,7 +2,7 @@ % This program is copyright (C) 1984 by D. E. Knuth; all rights are reserved. @y % This program is MFLua, strictly based on the METAFONT 2.7182818 source code. -% What follow are the original comments of METAFONT 2.7182818. +% What follow are the original comments of METAFONT 2.7182818. % This program is copyright (C) 1984 by D. E. Knuth; all rights are reserved. @z @@ -19,7 +19,7 @@ @y @d METAFONT_banner=='This is METAFONT, Version 2.7182818' {printed when \MF\ starts} @# -@d MFLua_version_string=='-0.8' +@d MFLua_version_string=='-0.9' @# @d MFLua_banner=='This is MFLua, Version 2.7182818', MFLua_version_string {printed when MFLua starts} @@ -496,17 +496,6 @@ end @ @= begin {begin\_file\_reading;} name:=2; {should be name:=3 but for the moment we keep 2} k:=first+length(cur_exp); -{print(" k=");print\_int(k);print\_ln;} -{print(" first=");print\_int(first);print\_ln;} -{print(" length(cur\_exp)=");print\_int(length(cur\_exp));print\_ln;} -{ Will be removed as soon as we have tested that it's ok} -{if k>=max\_buf\_stack then} -{ begin if k>=buf\_size then} -{ begin max\_buf\_stack:=buf\_size;} -{ overflow("buffer size",buf\_size);} -{ end;} -{ max\_buf\_stack:=k+1;} -{ end;} j:=str_start[cur_exp]; limit:=k; mflua_runscript(j,first,limit); lua_cur_exp:=make_string; @@ -515,12 +504,6 @@ begin begin_file_reading; add_str_ref(lua_cur_exp); j:=str_start[lua_cur_exp]; k:=first+length(lua_cur_exp);limit:=k; -{ Will be removed as soon as we have tested that it's ok} -{print("=============BEGIN TEST===============");print\_ln;} -{print(" k=");print\_int(k);print\_ln;} -{print(" first=");print\_int(first);print\_ln;} -{print(" limit=");print\_int(limit);print\_ln;} -{print(" length(lua\_cur\_exp)=");print\_int(length(lua\_cur\_exp));print\_ln;} if k>=max_buf_stack then begin if k>=buf_size then begin max_buf_stack:=buf_size; @@ -535,9 +518,9 @@ begin buffer[first]:=so(str_pool[j]); {print(so(str\_pool[j]));} incr(j); incr(first); end; buffer[limit]:="%"; first:=limit+1; loc:=start; - {print("=============END TEST=================");print\_ln;} - delete_str_ref(lua_cur_exp); + {delete_str_ref(lua_cur_exp);} end; +delete_str_ref(lua_cur_exp); flush_cur_exp(0); end @* \[51] System-dependent changes. diff --git a/Build/source/texk/web2c/mfluadir/mflua_version.h b/Build/source/texk/web2c/mfluadir/mflua_version.h index d9c6106a2d2..7e5ddb329c1 100644 --- a/Build/source/texk/web2c/mfluadir/mflua_version.h +++ b/Build/source/texk/web2c/mfluadir/mflua_version.h @@ -1 +1 @@ -#define MFLUA_VERSION "0.8" +#define MFLUA_VERSION "0.9" diff --git a/Build/source/texk/web2c/mfluadir/mfluac.c b/Build/source/texk/web2c/mfluadir/mfluac.c index 0f351850be4..ee014ec6f9b 100644 --- a/Build/source/texk/web2c/mfluadir/mfluac.c +++ b/Build/source/texk/web2c/mfluadir/mfluac.c @@ -1379,7 +1379,6 @@ int mfluarunscript(halfword j, halfword first, halfword limit) /* end of a C string */ strpool[j+limit-first] = '\0'; str = (const char *)(strpool+j) ; - /*fprintf(stderr,"\n! str=%s\n",str);*/ /* do the call (0 arguments, 1 result) */ error = (luaL_loadstring(L, str) || lua_pcall(L, 0, 1, 0)) ; strpool[j+limit-first] = last_char; -- cgit v1.2.3