Code: Select all
void add_builtins(tcl_bind_list_t *tl, cmd_t *cc)
{
int k, i;
char p[1024], *l;
cd_tcl_cmd table[2];
table[0].name = p;
table[0].callback = tl->func;
table[1].name = NULL;
for (i = 0; cc[i].name; i++) {
egg_snprintf(p, sizeof p, "*%s:%s", tl->name,
cc[i].funcname ? cc[i].funcname : cc[i].name);
k = TCL_DONT_USE_BRACES;
l = nmalloc(Tcl_ScanElement(p, &k));
Tcl_ConvertElement(p, l, k | TCL_DONT_USE_BRACES);
table[0].cdata = (void *) cc[i].func;
add_cd_tcl_cmds(table);
bind_bind_entry(tl, cc[i].flags, cc[i].name, l);
nfree(l);
}
}
Code: Select all
void add_builtins(tcl_bind_list_t *tl, cmd_t *cc)
{
int k, i, size;
char p[1024], *l;
cd_tcl_cmd table[2];
table[0].name = p;
table[0].callback = tl->func;
table[1].name = NULL;
for (i = 0; cc[i].name; i++) {
egg_snprintf(p, sizeof p, "*%s:%s", tl->name,
cc[i].funcname ? cc[i].funcname : cc[i].name);
size = Tcl_ScanElement(p, &k);
putlog(LOG_MISC, "*", "Allocating %u bytes for builtin \"%s\", flags: %u", size, p, k);
l = nmalloc(size);
Tcl_ConvertElement(p, l, k | TCL_DONT_USE_BRACES);
table[0].cdata = (void *) cc[i].func;
add_cd_tcl_cmds(table);
bind_bind_entry(tl, cc[i].flags, cc[i].name, l);
nfree(l);
}
}
Code: Select all
diff -urN eggdrop1.6.20/src/tclhash.c eggdrop1.6.20.fix/src/tclhash.c
--- eggdrop1.6.20/src/tclhash.c 2010-06-29 17:52:24.000000000 +0200
+++ eggdrop1.6.20.fix/src/tclhash.c 2011-07-08 23:45:37.000000000 +0200
@@ -1264,7 +1264,7 @@
for (i = 0; cc[i].name; i++) {
egg_snprintf(p, sizeof p, "*%s:%s", tl->name,
cc[i].funcname ? cc[i].funcname : cc[i].name);
- l = nmalloc(Tcl_ScanElement(p, &k));
+ l = nmalloc(Tcl_ScanElement(p, &k)+1);
Tcl_ConvertElement(p, l, k | TCL_DONT_USE_BRACES);
table[0].cdata = (void *) cc[i].func;
add_cd_tcl_cmds(table);
@@ -1282,7 +1282,7 @@
for (i = 0; cc[i].name; i++) {
egg_snprintf(p, sizeof p, "*%s:%s", table->name,
cc[i].funcname ? cc[i].funcname : cc[i].name);
- l = nmalloc(Tcl_ScanElement(p, &k));
+ l = nmalloc(Tcl_ScanElement(p, &k)+1);
Tcl_ConvertElement(p, l, k | TCL_DONT_USE_BRACES);
Tcl_DeleteCommand(interp, p);
unbind_bind_entry(table, cc[i].flags, cc[i].name, l);