NOEXPORT void log_queue(SERVICE_OPTIONS *opt,
        int level, char *stamp, char *id, char *text) {
    struct LIST *tmp;

    /* make a new element */
    tmp=str_alloc_detached(sizeof(struct LIST));
    tmp->next=NULL;
    tmp->opt=opt;
    tmp->level=level;
    tmp->stamp=stamp;
    str_detach(tmp->stamp);
    tmp->id=id;
    str_detach(tmp->id);
    tmp->text=text;
    str_detach(tmp->text);

    /* append the new element to the list */
    CRYPTO_THREAD_write_lock(stunnel_locks[LOCK_LOG_BUFFER]);
    if(tail)
        tail->next=tmp;
    else
        head=tmp;
    tail=tmp;
    if(stunnel_locks[LOCK_LOG_BUFFER])
    CRYPTO_THREAD_unlock(stunnel_locks[LOCK_LOG_BUFFER]);
}
NOEXPORT void log_queue(SERVICE_OPTIONS *opt,
        int level, char *stamp, char *id, char *text) {
    struct LIST *tmp;

     
    tmp=str_alloc_detached(sizeof(struct LIST));
    tmp->next=NULL;
    tmp->opt=opt;
    tmp->level=level;
    tmp->stamp=stamp;
    str_detach(tmp->stamp);
    tmp->id=id;
    str_detach(tmp->id);
    tmp->text=text;
    str_detach(tmp->text);

     
    CRYPTO_THREAD_write_lock(stunnel_locks[LOCK_LOG_BUFFER]);
    if(tail)
        tail->next=tmp;
    else
        head=tmp;
    tail=tmp;
    if(stunnel_locks[LOCK_LOG_BUFFER])
    CRYPTO_THREAD_unlock(stunnel_locks[LOCK_LOG_BUFFER]);
}