From 4ab162065d72217bcad27748442cbb27860c0cbd Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 1 Sep 2002 18:12:05 +0000 Subject: [PATCH] Invalidate string rep. Before make expandable buffer. --- base/parse.c | 1 + hbytes/chop.c | 6 ++++-- hbytes/parse.c | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/base/parse.c b/base/parse.c index a7ac819..1e1e5bb 100644 --- a/base/parse.c +++ b/base/parse.c @@ -49,6 +49,7 @@ int pat_hbv(Tcl_Interp *ip, Tcl_Obj *var, HBytes_Var *agg) { void fini_hbv(Tcl_Interp *ip, int rc, HBytes_Var *agg) { Tcl_Obj *ro; + Tcl_InvalidateStringRep(agg->obj); if (!rc) { assert(agg->obj); ro= Tcl_ObjSetVar2(ip,agg->var,0,agg->obj,TCL_LEAVE_ERR_MSG); diff --git a/hbytes/chop.c b/hbytes/chop.c index 5d89cd2..4999533 100644 --- a/hbytes/chop.c +++ b/hbytes/chop.c @@ -13,6 +13,8 @@ static int strs(Tcl_Interp *ip, int strc, Tcl_Obj *const *strv, int *l_r) { rc= Tcl_ConvertToType(ip,strv[i],&hbytes_type); if (rc) return rc; l += HBYTES_LEN(HBYTES(strv[i])); +fprintf(stderr,"strs #%d %d %02x\n",i,l, + HBYTES(strv[i]).start ? HBYTES(strv[i]).start[0] : 0xff); } *l_r= l; return TCL_OK; @@ -40,12 +42,12 @@ int app_pre(ClientData cd, Tcl_Interp *ip, int begin, int do_hbytes_append(ClientData cd, Tcl_Interp *ip, HBytes_Var v, int strc, Tcl_Obj *const *strv) { - return app_pre(cd,ip,1,v,strc,strv); + return app_pre(cd,ip,0,v,strc,strv); } int do_hbytes_prepend(ClientData cd, Tcl_Interp *ip, HBytes_Var v, int strc, Tcl_Obj *const *strv) { - return app_pre(cd,ip,0,v,strc,strv); + return app_pre(cd,ip,1,v,strc,strv); } int do_hbytes_concat(ClientData cd, Tcl_Interp *ip, diff --git a/hbytes/parse.c b/hbytes/parse.c index a7ac819..1e1e5bb 100644 --- a/hbytes/parse.c +++ b/hbytes/parse.c @@ -49,6 +49,7 @@ int pat_hbv(Tcl_Interp *ip, Tcl_Obj *var, HBytes_Var *agg) { void fini_hbv(Tcl_Interp *ip, int rc, HBytes_Var *agg) { Tcl_Obj *ro; + Tcl_InvalidateStringRep(agg->obj); if (!rc) { assert(agg->obj); ro= Tcl_ObjSetVar2(ip,agg->var,0,agg->obj,TCL_LEAVE_ERR_MSG); -- 2.30.2