MEDIUM: stream interface: move the peers' ptr into the applet context
A long time ago when peers were introduced, there was no applet nor
applet context. Applet contexts were introduced but the peers still
did not make use of them and the "ptr" pointer remains present in
every stream interface in addition to the other contexts.
Simply move this pointer to its own location in the context.
Note that this pointer is still a void* because its type and contents
varies depending on the peers session state. Probably that this could
be cleaned up in the future given that all other contexts already store
much more than a single pointer.
diff --git a/include/types/stream_interface.h b/include/types/stream_interface.h
index 9f8afef..84fec07 100644
--- a/include/types/stream_interface.h
+++ b/include/types/stream_interface.h
@@ -122,7 +122,6 @@
unsigned int st0; /* CLI state for stats, session state for peers */
unsigned int st1; /* prompt for stats, session error for peers */
unsigned int st2; /* output state for stats, unused by peers */
- void *ptr; /* struct peer for peers */
union {
struct {
@@ -162,6 +161,9 @@
struct {
const char *msg; /* pointer to a persistent message to be returned in PRINT state */
} cli;
+ struct {
+ void *ptr; /* multi-purpose pointer for peers */
+ } peers;
} ctx; /* used by stats I/O handlers to dump the stats */
} applet;
};