Blind commit:

Re: Untested patch: back-tcl used wrong types  (ITS#1719)

			================
Written by Hallvard B. Furuseth and placed into the public domain.
This software is not subject to any license of the University of Oslo.
			================

> I turned it into an automatic variable.

...and used a variable-length array.  That's a gcc extension, it is not
in ANSI C89.  (It is in C99 though.)  You seem to be compiling without
-pedantic:-)  Anyway, here is a patch to turn it back into ch_malloc(),
plus some README fixes
This commit is contained in:
Kurt Zeilenga 2002-04-18 19:28:26 +00:00
parent 202aa8c793
commit 96eda541e9
3 changed files with 11 additions and 5 deletions

View file

@ -25,7 +25,7 @@ compare <proc>
abandon <proc>
# This is one of the biggest pluses of using the tcl backend.
# The realm let's you group several databases to the same interpreter.
# The realm lets you group several databases to the same interpreter.
# This basically means they share the same global variables and proc
# space. So global variables, as well as all the procs, are callable
# between databases. If no tclrealm is specified, it is put into the
@ -109,7 +109,7 @@ modrdn { action msgid suffix dn newrdn deleteoldrdn }
msgid - The msgid of this ldap session
suffix - List of suffix(es) associated with the call. Each one
is and entry in a tcl formatted list (surrounded by {}'s)
dn - DN who's RDN is being renamed
dn - DN whose RDN is being renamed
newrdn - New RDN
deleteoldrdn - Boolean stating whether or not the old RDN should
be removed after being renamed

View file

@ -47,12 +47,12 @@ tcl_back_search (
for (i = 0, an = attrs; an && an->an_name.bv_val; an++, i++);
if (i > 0) {
char *sattrs[i+1];
char **sattrs = ch_malloc( (i+1) * sizeof(char *));
for (i = 0, an = attrs; an->an_name.bv_val; an++, i++)
sattrs[i] = an->an_name.bv_val;
sattrs[i] = NULL;
attrs_tcl = Tcl_Merge (i, sattrs);
ch_free(sattrs);
}
if (tcl_merge_bvlist (be->be_suffix, &suf_tcl) == NULL) {

View file

@ -215,13 +215,19 @@ tcl_merge_bvlist(
for (i = 0; bvlist[i] != NULL; i++);
if (i) {
char *strlist[i + 1];
char **strlist = ch_malloc ((i + 1) * sizeof(char *));
if (strlist == NULL) {
if (out == NULL)
ch_free (ret);
return NULL;
}
for (i = 0; bvlist[i] != NULL; i++) {
strlist[i] = bvlist[i]->bv_val;
}
strlist[i] = NULL;
ret->bv_val = Tcl_Merge(i, strlist);
ret->bv_len = ret->bv_val ? strlen(ret->bv_val) : 0;
ch_free (strlist);
}
return ret;