/* The destination specified by rds is coming to a close. If there's any cleanup that needs to be done, do it now.  */
int ecEndGroupAction(RTF_Context *ctx, RDS rds)
/* The destination specified by rds is coming to a close. If there's any cleanup that needs to be done, do it now.  */
int ecEndGroupAction(RTF_Context *ctx, RDS rds)
{
    switch (ctx->rds)
    {
        case rdsTitle:
            if (ctx->title)
                free(ctx->title);
            ctx->data[ctx->datapos] = '\0';
            ctx->title = *ctx->data ? strdup(ctx->data) : NULL;
            ctx->datapos = 0;
            break;
        case rdsSubject:
            if (ctx->subject)
                free(ctx->subject);
            ctx->data[ctx->datapos] = '\0';
            ctx->subject = *ctx->data ? strdup(ctx->data) : NULL;
            ctx->datapos = 0;
            break;
        case rdsAuthor:
            if (ctx->author)
                free(ctx->author);
            ctx->data[ctx->datapos] = '\0';
            ctx->author = *ctx->data ? strdup(ctx->data) : NULL;
            ctx->datapos = 0;
            break;
        default:
            break;
    }
    return ecOK;
}