ossp-pkg/l2/l2_ch_prefix.c 1.9 -> 1.10
--- l2_ch_prefix.c 2001/09/06 14:37:53 1.9
+++ l2_ch_prefix.c 2001/09/06 16:10:05 1.10
@@ -86,17 +86,13 @@
static l2_result_t hook_write(l2_context_t *ctx, l2_channel_t *ch,
const char *buf, size_t buf_size)
{
- l2_ch_prefix_t *cfg;
- l2_channel_t *downstream;
+ l2_ch_prefix_t *cfg = (l2_ch_prefix_t *)ctx->vp;
+ l2_channel_t *downstream = l2_channel_downstream(ch);
time_t t;
struct tm *tm;
size_t n;
l2_result_t rv;
- /* get environment */
- cfg = (l2_ch_prefix_t *)ctx->vp;
- downstream = l2_channel_downstream(ch);
-
/* optionally provide prefix */
if (cfg->timefmt != NULL) {
t = time(NULL);
@@ -124,12 +120,12 @@
{
l2_ch_prefix_t *cfg = (l2_ch_prefix_t *)ctx->vp;
+ /* free prefix structure */
if (cfg->timefmt != NULL)
free(cfg->timefmt);
if (cfg->timezone != NULL)
free(cfg->timezone);
free(cfg);
- ctx->vp = NULL;
return L2_OK;
}
|
|