- return staticerr(ip, "hbytes overwrite start -ve");
- if (start + sub_l > hbytes_len(v.hb))
- return staticerr(ip, "hbytes overwrite out of range");
- memcpy(hbytes_data(v.hb) + start, hbytes_data(&sub), sub_l);
+ return cht_staticerr(ip, "hbytes overwrite start -ve",
+ "HBYTES LENGTH RANGE");
+ if (start + sub_l > cht_hb_len(v.hb))
+ return cht_staticerr(ip, "hbytes overwrite out of range",
+ "HBYTES LENGTH UNDERRUN");
+ memcpy(cht_hb_data(v.hb) + start, cht_hb_data(&sub), sub_l);
+ return TCL_OK;
+}
+
+int cht_do_hbytes_trimleft(ClientData cd, Tcl_Interp *ip, HBytes_Var v) {
+ const Byte *o, *p, *e;
+ o= p= cht_hb_data(v.hb);
+ e= p + cht_hb_len(v.hb);
+
+ while (p<e && !*p) p++;
+ if (p != o)
+ cht_hb_unprepend(v.hb, p-o);
+