Completed open/close/destroy implementations

This commit is contained in:
Ben Collins 1999-02-17 02:02:11 +00:00
parent 749404b83f
commit 197e77ea8d
2 changed files with 32 additions and 7 deletions

View File

@ -8,9 +8,12 @@
* license is available at http://www.OpenLDAP.org/license.html or
* in file LICENSE in the top-level directory of the distribution.
*
* $Id$
* $Id: tcl_close.c,v 1.2 1999/02/17 00:55:03 bcollins Exp $
*
* $Log: tcl_close.c,v $
* Revision 1.2 1999/02/17 00:55:03 bcollins
* Implemented all of the (db_)destroy and (db_)close functions
*
* $Log$
*/
#include "portable.h"
@ -26,8 +29,6 @@ tcl_back_close (
)
{
Tcl_DeleteInterp(global_i->interp);
Tcl_Free(global_i->interp);
free(global_i);
return( 0 );
}
@ -37,6 +38,8 @@ tcl_back_destroy(
BackendInfo *bi
)
{
Tcl_Free(global_i->interp);
free(global_i);
ldap_pvt_thread_mutex_destroy( &tcl_interpreter_mutex );
return( 0 );

View File

@ -8,9 +8,12 @@
* license is available at http://www.OpenLDAP.org/license.html or
* in file LICENSE in the top-level directory of the distribution.
*
* $Id$
* $Id: tcl_init.c,v 1.2 1999/02/17 00:55:54 bcollins Exp $
*
* $Log: tcl_init.c,v $
* Revision 1.2 1999/02/17 00:55:54 bcollins
* Implemented the open, init functions correctly
*
* $Log$
*/
#include "portable.h"
@ -41,7 +44,7 @@ tcl_back_initialize(
ldap_pvt_thread_mutex_init( &tcl_interpreter_mutex );
bi->bi_open = tcl_back_open;
bi->bi_config = tcl_back_config;
bi->bi_config = NULL;
bi->bi_close = tcl_back_close;
bi->bi_destroy = tcl_back_destroy;
@ -66,6 +69,25 @@ tcl_back_initialize(
return 0;
}
int
tcl_back_open(
BackendInfo *bi
)
{
/* Initialize the global interpreter array */
global_i = (struct i_info *) ch_malloc (sizeof (struct i_info));
global_i->count = 0;
global_i->name = "default";
global_i->next = NULL;
global_i->interp = Tcl_CreateInterp ();
Tcl_Init (global_i->interp);
/* Initialize the global interpreter lock */
ldap_pvt_thread_mutex_init( &tcl_interpreter_mutex );
return( 0 );
}
int
tcl_back_db_init(
Backend *be