OSSP CVS Repository

ossp - Difference in ossp-pkg/l2/l2_ch_buffer.c versions 1.15 and 1.16
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/l2/l2_ch_buffer.c 1.15 -> 1.16

--- l2_ch_buffer.c       2001/09/06 11:47:51     1.15
+++ l2_ch_buffer.c       2001/09/06 14:37:53     1.16
@@ -45,7 +45,7 @@
 
     /* allocate private channel configuration */
     if ((cfg = (l2_ch_buffer_t *)malloc(sizeof(l2_ch_buffer_t))) == NULL)
-        return L2_ERROR;
+        return L2_ERR_MEM;
 
     /* initialize configuration with reasonable defaults */
     cfg->buf     = NULL;
@@ -67,14 +67,14 @@
 
     /* parameter checks */
     if ((cfg = (l2_ch_buffer_t *)ctx->vp) == NULL)
-        return L2_ERROR;
+        return L2_ERR_ARG;
 
     /* feed and call generic parameter parsing engine */
     L2_PARAM_SET(pa[0], size, INT, &cfg->bufsize);
     L2_PARAM_END(pa[1]);
     rv = l2_util_setparams(pa, fmt, ap);
     if (cfg->bufsize < 0) 
-        return L2_ERROR;
+        return L2_ERR_ARG;
     return rv;
 }
 
@@ -83,22 +83,23 @@
 {
     l2_ch_buffer_t *cfg;
     l2_channel_t *downstream;
+    l2_result_t rv;
 
     /* parameter checks */
     if ((cfg = (l2_ch_buffer_t *)ctx->vp) == NULL)
-        return L2_ERROR;
+        return L2_ERR_ARG;
 
     /* open channel buffer */
     if (cfg->bufsize > 0) {
         if ((cfg->buf = malloc(cfg->bufsize)) == NULL)
-            return L2_ERROR;
+            return L2_ERR_MEM;
         cfg->bufpos = 0;
     }
 
     /* optionally open downstream channel, too */
     if ((downstream = l2_channel_downstream(ch)) != NULL)
-        if (l2_channel_open(downstream) == L2_ERROR)
-            return L2_ERROR;
+        if ((rv = l2_channel_open(downstream)) != L2_OK)
+            return rv;
 
     return L2_OK;
 }
@@ -113,7 +114,7 @@
 
     /* parameter checks */
     if ((cfg = (l2_ch_buffer_t *)ctx->vp) == NULL)
-        return L2_ERROR;
+        return L2_ERR_ARG;
 
     if (bufsize > (cfg->bufsize - cfg->bufpos)) {
         /* flush buffer if necessary */
@@ -139,23 +140,24 @@
 {
     l2_ch_buffer_t *cfg;
     l2_channel_t *downstream;
+    l2_result_t rv;
 
     /* parameter checks */
     if ((cfg = (l2_ch_buffer_t *)ctx->vp) == NULL)
-        return L2_ERROR;
+        return L2_ERR_ARG;
 
     /* write the buffer contents downstream */
     if (cfg->bufpos > 0) {
         if ((downstream = l2_channel_downstream(ch)) != NULL)
-            if (l2_channel_write(downstream, cfg->buf, cfg->bufpos) == L2_ERROR)
-                return L2_ERROR;
+            if ((rv = l2_channel_write(downstream, cfg->buf, cfg->bufpos)) != L2_OK)
+                return rv;
         cfg->bufpos = 0;
     }
 
     /* optionally flush downstream channel, too */
     if ((downstream = l2_channel_downstream(ch)) != NULL)
-        if (l2_channel_flush(downstream) == L2_ERROR)
-            return L2_ERROR;
+        if ((rv = l2_channel_flush(downstream)) != L2_OK)
+            return rv;
 
     return L2_OK;
 }
@@ -165,23 +167,24 @@
 {
     l2_ch_buffer_t *cfg;
     l2_channel_t *downstream;
+    l2_result_t rv;
 
     /* parameter checks */
     if ((cfg = (l2_ch_buffer_t *)ctx->vp) == NULL)
-        return L2_ERROR;
+        return L2_ERR_ARG;
 
     /* write stale data before closing down */
     if (cfg->bufpos > 0) {
         if ((downstream = l2_channel_downstream(ch)) != NULL)
-            if (l2_channel_write(downstream, cfg->buf, cfg->bufpos) == L2_ERROR)
-                return L2_ERROR;
+            if ((rv = l2_channel_write(downstream, cfg->buf, cfg->bufpos)) != L2_OK)
+                return rv;
         cfg->bufpos = 0;
     }
 
     /* optionally close downstream channel, too */
     if ((downstream = l2_channel_downstream(ch)) != NULL)
-        if (l2_channel_close(downstream) == L2_ERROR)
-            return L2_ERROR;
+        if ((rv = l2_channel_close(downstream)) != L2_OK)
+            return rv;
 
     /* close channel buffer */
     if (cfg->buf != NULL) {
@@ -199,7 +202,7 @@
 
     /* parameter checks */
     if ((cfg = (l2_ch_buffer_t *)ctx->vp) == NULL)
-        return L2_ERROR;
+        return L2_ERR_ARG;
 
     /* if not already closed, close channel buffer now */
     if (cfg->buf != NULL) {

CVSTrac 2.0.1