chiark / gitweb /
Lots of stuff seems to work
[chiark-tcl.git] / base / parse.c
index 1e1e5bb2ba616b13d3a27e08e8a9c74d1458c8c6..e5e3465c93c450eea9357c55e35718663ed58f03 100644 (file)
@@ -42,7 +42,7 @@ int pat_hbv(Tcl_Interp *ip, Tcl_Obj *var, HBytes_Var *agg) {
   rc= Tcl_ConvertToType(ip,val,&hbytes_type);
   if (rc) return rc;
 
-  agg->hb= &HBYTES(val);
+  agg->hb= OBJ_HBYTES(val);
   return TCL_OK;
 }
 
@@ -62,12 +62,17 @@ void fini_hbv(Tcl_Interp *ip, int rc, HBytes_Var *agg) {
 int pat_hb(Tcl_Interp *ip, Tcl_Obj *obj, HBytes_Value *val) {
   int rc;
   rc= Tcl_ConvertToType(ip,obj,&hbytes_type);  if (rc) return rc;
-  *val= HBYTES(obj);
+  *val= *OBJ_HBYTES(obj);
   return TCL_OK;
 }
 
 Tcl_Obj *ret_hb(Tcl_Interp *ip, HBytes_Value val) {
-  return hbytes_set_obj(0, val.start, HBYTES_LEN(val));
+  Tcl_Obj *obj;
+  obj= Tcl_NewObj();
+  Tcl_InvalidateStringRep(obj);
+  *OBJ_HBYTES(obj)= val;
+  obj->typePtr= &hbytes_type;
+  return obj;
 }
 
 Tcl_Obj *ret_obj(Tcl_Interp *ip, Tcl_Obj *val) {