OSSP CVS Repository

ossp - Difference in ossp-pkg/xds/xds.c versions 1.9 and 1.10
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/xds/xds.c 1.9 -> 1.10

--- xds.c        2002/03/17 10:25:53     1.9
+++ xds.c        2003/02/17 12:27:51     1.10
@@ -33,20 +33,21 @@
 
 #include "xds_p.h"
 
-xds_t *xds_init(xds_mode_t mode)
+int xds_init(xds_t **xds, xds_mode_t mode)
 {
     xds_t *ctx;
 
     /* Sanity check parameter. */
+    assert(xds != NULL);
+    if (xds == NULL)
+        return XDS_ERR_INVALID_ARG;
     assert(mode == XDS_ENCODE || mode == XDS_DECODE);
-    if (mode != XDS_ENCODE && mode != XDS_DECODE) {
-        errno = EINVAL;
-        return NULL;
-    }
+    if (mode != XDS_ENCODE && mode != XDS_DECODE)
+        return XDS_ERR_INVALID_ARG;
 
     /* Allocate context structure. */
     if ((ctx = malloc(sizeof (struct xds_context))) == NULL)
-        return NULL; /* errno set by malloc(3) */
+        return XDS_ERR_SYSTEM; /* errno set by malloc(3) */
 
     /* Set mode of operation in context. */
     ctx->mode = mode;
@@ -62,17 +63,19 @@
     ctx->engines_len = 0;
     ctx->engines_capacity = 0;
 
-    return ctx;
+    *xds = ctx;
+
+    return XDS_OK;
 }
 
-void xds_destroy(xds_t *xds)
+int xds_destroy(xds_t *xds)
 {
     size_t i;
 
     /* Sanity check parameter. */
     assert(xds != NULL);
     if (xds == NULL)
-        return;
+        return XDS_ERR_INVALID_ARG;
 
     /* Free allocated memory. */
     assert(xds->buffer != NULL
@@ -89,7 +92,7 @@
     }
     free(xds);
 
-    return;
+    return XDS_OK;
 }
 
 int xds_setbuffer(xds_t *xds, xds_scope_t flag, void *buffer,

CVSTrac 2.0.1