OSSP CVS Repository

ossp - Check-in [473]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 473
Date: 2001-May-17 16:43:26 (local)
2001-May-17 14:43:26 (UTC)
User:simons
Branch:
Comment: Implemented l2_stream_create(), l2_stream_destroy(), and l2_stream_channel().
Tickets:
Inspections:
Files:
ossp-pkg/l2/l2_stream.c      1.1 -> 1.2     29 inserted, 0 deleted

ossp-pkg/l2/l2_stream.c 1.1 -> 1.2

--- l2_stream.c  2001/05/10 19:46:01     1.1
+++ l2_stream.c  2001/05/17 14:43:26     1.2
@@ -31,3 +31,32 @@
 #include "l2.h"
 #include "l2_p.h"
 
+l2_stream_t* l2_stream_create(void)
+    {
+    l2_stream_t *st;
+    st = (l2_stream_t *)malloc(sizeof(l2_stream_t));
+    if (!st)
+        return NULL;
+    memset(st, 0, sizeof(l2_stream_t));
+    return st;
+    }
+
+void l2_stream_destroy(l2_stream_t* st)
+    {
+    size_t i;
+    for (i = 0; i <= L2_MAX_CHANNELS && st->channels[i]; ++i)
+        l2_channel_destroy(st->channels[i]);
+    for (i = 0; i <= L2_MAX_FORMATTERS && st->formatters[i]; ++i)
+        free(st->formatters[i]);
+    }
+
+l2_stream_t* l2_stream_channel(l2_stream_t *st, l2_channel_t *ch, unsigned int levelmask)
+    {
+    size_t i;
+    for (i = 0; i <= L2_MAX_CHANNELS && st->channels[i]; ++i)
+        ;
+    if (i == L2_MAX_CHANNELS)
+        return 0;               /* Array is full. */
+    st->channels[i] = ch;
+    return st;
+    }

CVSTrac 2.0.1