Index: ossp-pkg/xds/destroy.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/destroy.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/xds/Attic/destroy.c,v' 2>/dev/null --- destroy.c 2001/07/04 15:58:51 1.1 +++ destroy.c 2001/07/04 16:21:26 1.2 @@ -25,8 +25,16 @@ SUCH DAMAGE. */ +#include +#include +#include #include "internal.h" void xds_destroy(xds_t* xds) { + assert(xds != NULL); + if (xds != NULL) + { + free(xds); + } } Index: ossp-pkg/xds/init.c RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/init.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/xds/Attic/init.c,v' 2>/dev/null --- init.c 2001/07/04 15:58:51 1.1 +++ init.c 2001/07/04 16:21:26 1.2 @@ -26,10 +26,34 @@ */ #include +#include +#include #include "internal.h" xds_t* xds_init(xds_mode_t mode) { - xds_t* ctx = calloc(1, sizeof(struct xds_context)); - return NULL; + xds_t* ctx; + + /* Sanity check parameter. */ + + assert(mode == XDS_ENCODE || mode == XDS_DECODE); + if (mode != XDS_ENCODE && mode != XDS_DECODE) + { + errno = EINVAL; + return NULL; + } + + /* Allocate context structure. */ + + ctx = calloc(1, sizeof(struct xds_context)); + if (ctx == NULL) + return NULL; /* errno is set by calloc() */ + + /* Set mode of operation in context. */ + + ctx->mode = mode; + + /* We are initialized. */ + + return ctx; }