chiark
/
gitweb
/
~ian
/
chiark-tcl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix memory and type management bugs.
[chiark-tcl.git]
/
base
/
hook.c
diff --git
a/base/hook.c
b/base/hook.c
index f364978c200db68dde9b2ba53c0a3e8faa898533..cdcb246d2c742b945ad8444faad1cd1705529b01 100644
(file)
--- a/
base/hook.c
+++ b/
base/hook.c
@@
-61,10
+61,10
@@
int do_hbytes_rep_info(ClientData cd, Tcl_Interp *ip,
}
static void hbytes_t_dup(Tcl_Obj *src, Tcl_Obj *dup) {
}
static void hbytes_t_dup(Tcl_Obj *src, Tcl_Obj *dup) {
- objfreeir(dup);
hbytes_array(OBJ_HBYTES(dup),
hbytes_data(OBJ_HBYTES(src)),
hbytes_len(OBJ_HBYTES(src)));
hbytes_array(OBJ_HBYTES(dup),
hbytes_data(OBJ_HBYTES(src)),
hbytes_len(OBJ_HBYTES(src)));
+ dup->typePtr= &hbytes_type;
}
static void hbytes_t_free(Tcl_Obj *o) {
}
static void hbytes_t_free(Tcl_Obj *o) {
@@
-210,6
+210,18
@@
int do_hbytes_overwrite(ClientData cd, Tcl_Interp *ip,
return TCL_OK;
}
return TCL_OK;
}
+int do_hbytes_trimleft(ClientData cd, Tcl_Interp *ip, HBytes_Var v) {
+ const Byte *o, *p, *e;
+ o= p= hbytes_data(v.hb);
+ e= p + hbytes_len(v.hb);
+
+ while (p<e && !*p) p++;
+ if (p != o)
+ hbytes_unprepend(v.hb, p-o);
+
+ return TCL_OK;
+}
+
int do_hbytes_repeat(ClientData cd, Tcl_Interp *ip,
HBytes_Value sub, int count, HBytes_Value *result) {
int sub_l;
int do_hbytes_repeat(ClientData cd, Tcl_Interp *ip,
HBytes_Value sub, int count, HBytes_Value *result) {
int sub_l;