* Sebastian Hammer, Adam Dickmeiss
*
* $Log: ir-tcl.c,v $
- * Revision 1.90 1996-06-27 14:21:00 adam
+ * Revision 1.91 1996-07-03 13:31:11 adam
+ * The xmalloc/xfree functions from YAZ are used to manage memory.
+ *
+ * Revision 1.90 1996/06/27 14:21:00 adam
* Yet another Windows port.
*
* Revision 1.89 1996/06/11 15:27:15 adam
default:
break;
}
- free (rl->u.dbrec.buf);
+ xfree (rl->u.dbrec.buf);
break;
case Z_NamePlusRecord_surrogateDiagnostic:
ir_deleteDiags (&rl->u.surrogateDiagnostics.list,
&rl->u.surrogateDiagnostics.num);
break;
}
- free (rl->elements);
+ xfree (rl->elements);
}
static IrTcl_RecordList *new_IR_record (IrTcl_SetObj *setobj,
interp->result);
}
Tcl_FreeResult (interp);
- free (tmp);
+ xfree (tmp);
return r;
}
{
delete_IR_record (rl);
rl1 = rl->next;
- free (rl);
+ xfree (rl);
}
setobj->record_list = NULL;
}
static void get_referenceId (char **dst, Z_ReferenceId *src)
{
- free (*dst);
+ xfree (*dst);
if (!src)
{
*dst = NULL;
return ir_tcl_strdel (interp, &p->implementationName);
if (argc == 3)
{
- free (p->implementationName);
+ xfree (p->implementationName);
if (ir_tcl_strdup (interp, &p->implementationName, argv[2])
== TCL_ERROR)
return TCL_ERROR;
if (argc >= 3 || argc == -1)
{
- free (p->idAuthenticationOpen);
- free (p->idAuthenticationGroupId);
- free (p->idAuthenticationUserId);
- free (p->idAuthenticationPassword);
+ xfree (p->idAuthenticationOpen);
+ xfree (p->idAuthenticationGroupId);
+ xfree (p->idAuthenticationUserId);
+ xfree (p->idAuthenticationPassword);
}
if (argc >= 3 || argc <= 0)
{
if (p->hostname)
{
logf(LOG_DEBUG, "Closing connection to %s", p->hostname);
- free (p->hostname);
+ xfree (p->hostname);
p->hostname = NULL;
ir_select_remove_write (cs_fileno (p->cs_link), p);
ir_select_remove (cs_fileno (p->cs_link), p);
return ir_tcl_strdel (interp, &obj->comstackType);
else if (argc == 3)
{
- free (obj->comstackType);
+ xfree (obj->comstackType);
if (ir_tcl_strdup (interp, &obj->comstackType, argv[2]) == TCL_ERROR)
return TCL_ERROR;
}
return ir_tcl_strdel (interp, &p->callback);
if (argc == 3)
{
- free (p->callback);
+ xfree (p->callback);
if (argv[2][0])
{
if (ir_tcl_strdup (interp, &p->callback, argv[2]) == TCL_ERROR)
return ir_tcl_strdel (interp, &p->failback);
else if (argc == 3)
{
- free (p->failback);
+ xfree (p->failback);
if (argv[2][0])
{
if (ir_tcl_strdup (interp, &p->failback, argv[2]) == TCL_ERROR)
return ir_tcl_strdel (interp, &p->initResponse);
if (argc == 3)
{
- free (p->initResponse);
+ xfree (p->initResponse);
if (argv[2][0])
{
if (ir_tcl_strdup (interp, &p->initResponse, argv[2]) == TCL_ERROR)
if (argc == -1)
{
for (i=0; i<p->num_databaseNames; i++)
- free (p->databaseNames[i]);
- free (p->databaseNames);
+ xfree (p->databaseNames[i]);
+ xfree (p->databaseNames);
}
if (argc <= 0)
{
if (p->databaseNames)
{
for (i=0; i<p->num_databaseNames; i++)
- free (p->databaseNames[i]);
- free (p->databaseNames);
+ xfree (p->databaseNames[i]);
+ xfree (p->databaseNames);
}
p->num_databaseNames = argc - 2;
p->databaseNames =
return ir_tcl_strdel (interp, &p->queryType);
if (argc == 3)
{
- free (p->queryType);
+ xfree (p->queryType);
if (ir_tcl_strdup (interp, &p->queryType, argv[2]) == TCL_ERROR)
return TCL_ERROR;
}
return ir_tcl_strdel (interp, &p->referenceId);
if (argc == 3)
{
- free (p->referenceId);
+ xfree (p->referenceId);
if (ir_tcl_strdup (interp, &p->referenceId, argv[2]) == TCL_ERROR)
return TCL_ERROR;
}
}
else if (argc == -1)
{
- free (p->preferredRecordSyntax);
+ xfree (p->preferredRecordSyntax);
p->preferredRecordSyntax = NULL;
return TCL_OK;
}
if (argc == 3)
{
- free (p->preferredRecordSyntax);
+ xfree (p->preferredRecordSyntax);
p->preferredRecordSyntax = NULL;
if (argv[2][0] && (p->preferredRecordSyntax =
ir_tcl_malloc (sizeof(*p->preferredRecordSyntax))))
return ir_tcl_strdel (interp, &p->elementSetNames);
if (argc == 3)
{
- free (p->elementSetNames);
+ xfree (p->elementSetNames);
if (ir_tcl_strdup (interp, &p->elementSetNames, argv[2]) == TCL_ERROR)
return TCL_ERROR;
}
return ir_tcl_strdel (interp, &p->smallSetElementSetNames);
if (argc == 3)
{
- free (p->smallSetElementSetNames);
+ xfree (p->smallSetElementSetNames);
if (ir_tcl_strdup (interp, &p->smallSetElementSetNames,
argv[2]) == TCL_ERROR)
return TCL_ERROR;
return ir_tcl_strdel (interp, &p->mediumSetElementSetNames);
if (argc == 3)
{
- free (p->mediumSetElementSetNames);
+ xfree (p->mediumSetElementSetNames);
if (ir_tcl_strdup (interp, &p->mediumSetElementSetNames,
argv[2]) == TCL_ERROR)
return TCL_ERROR;
odr_destroy (obj->odr_in);
odr_destroy (obj->odr_out);
odr_destroy (obj->odr_pr);
- free (obj);
+ xfree (obj);
}
/*
return ir_tcl_strdel (interp, &obj->searchResponse);
if (argc == 3)
{
- free (obj->searchResponse);
+ xfree (obj->searchResponse);
if (argv[2][0])
{
if (ir_tcl_strdup (interp, &obj->searchResponse, argv[2])
return ir_tcl_strdel (interp, &obj->presentResponse);
if (argc == 3)
{
- free (obj->presentResponse);
+ xfree (obj->presentResponse);
if (argv[2][0])
{
if (ir_tcl_strdup (interp, &obj->presentResponse, argv[2])
return ir_tcl_strdel (interp, &obj->setName);
if (argc == 3)
{
- free (obj->setName);
+ xfree (obj->setName);
if (ir_tcl_strdup (interp, &obj->setName, argv[2])
== TCL_ERROR)
return TCL_ERROR;
}
if (argc == 3)
{
- free (obj->recordElements);
+ xfree (obj->recordElements);
return ir_tcl_strdup (NULL, &obj->recordElements,
(*argv[2] ? argv[2] : NULL));
}
ir_tcl_method (NULL, -1, NULL, tabs, NULL);
- free (p);
+ xfree (p);
}
/*
return ir_tcl_strdel (interp, &obj->scanResponse);
if (argc == 3)
{
- free (obj->scanResponse);
+ xfree (obj->scanResponse);
if (argv[2][0])
{
if (ir_tcl_strdup (interp, &obj->scanResponse, argv[2])
tabs[1].tab = NULL;
ir_tcl_method (NULL, -1, NULL, tabs, NULL);
- free (obj);
+ xfree (obj);
}
/*
get_referenceId (&p->set_inher.referenceId, initrs->referenceId);
- free (p->targetImplementationId);
+ xfree (p->targetImplementationId);
ir_tcl_strdup (p->interp, &p->targetImplementationId,
initrs->implementationId);
- free (p->targetImplementationName);
+ xfree (p->targetImplementationName);
ir_tcl_strdup (p->interp, &p->targetImplementationName,
initrs->implementationName);
- free (p->targetImplementationVersion);
+ xfree (p->targetImplementationVersion);
ir_tcl_strdup (p->interp, &p->targetImplementationVersion,
initrs->implementationVersion);
memcpy (&p->options, initrs->options, sizeof(initrs->options));
memcpy (&p->protocolVersion, initrs->protocolVersion,
sizeof(initrs->protocolVersion));
- free (p->userInformationField);
+ xfree (p->userInformationField);
p->userInformationField = NULL;
if (initrs->userInformationField)
{
{
int i;
for (i = 0; i<*dst_num; i++)
- free (dst_list[i]->addinfo);
- free (*dst_list);
+ xfree (dst_list[i]->addinfo);
+ xfree (*dst_list);
*dst_list = NULL;
*dst_num = 0;
}
scanobj->positionOfTerm = -1;
logf (LOG_DEBUG, "positionOfTerm=%d", scanobj->positionOfTerm);
- free (scanobj->entries);
+ xfree (scanobj->entries);
scanobj->entries = NULL;
ir_deleteDiags (&scanobj->nonSurrogateDiagnosticList,
ir_tcl_eval (p->interp, apdu_call);
else if (rq->callback)
ir_tcl_eval (p->interp, rq->callback);
- free (rq->buf_out);
- free (rq->callback);
- free (rq->object_name);
- free (rq);
+ xfree (rq->buf_out);
+ xfree (rq->callback);
+ xfree (rq->object_name);
+ xfree (rq);
odr_reset (p->odr_in);
if (p->ref_count == 1)
{
{
logf (LOG_DEBUG, "cs_put write fail");
p->ref_count = 2;
- free (rq->buf_out);
+ xfree (rq->buf_out);
rq->buf_out = NULL;
ir_tcl_disconnect (p);
if (p->failback)
logf (LOG_DEBUG, "Write completed");
p->state = IR_TCL_R_Waiting;
ir_select_remove_write (cs_fileno (p->cs_link), p);
- free (rq->buf_out);
+ xfree (rq->buf_out);
rq->buf_out = NULL;
}
return 1;