Ignore:
Timestamp:
Jul 18, 2015, 5:06:52 PM (6 years ago)
Author:
katerina
Message:

Enhancements and fixes for tickets #374, #375, #376, #377, #378, and #379.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/sh_fifo.h

    r272 r481  
    3333} SH_FIFO;
    3434
     35#define SH_FIFO_INITIALIZER { NULL, NULL, 0 }
     36
    3537/*****************************************************
    3638 *
     
    4244 *
    4345 */
    44 #define fifo_init(fifo_p) { fifo_p->fifo_cts = 0; fifo_p->head_ptr = NULL; \
    45  fifo_p->tail_ptr = NULL; }
     46#define fifo_init(fifo_p) { (fifo_p)->fifo_cts = 0; (fifo_p)->head_ptr = NULL; \
     47    (fifo_p)->tail_ptr = NULL; }
    4648
    4749
     
    5052 * Returns: -1 if the list is full, 0 on success
    5153 */
    52 int push_list (SH_FIFO * fifo, char * indat, int in_i, const char * in_str);
     54int push_list (SH_FIFO * fifo, const char * indat, int in_i, const char * in_str);
     55#define sh_fifo_push(a, b) push_list((a), (b), 0, NULL)
    5356
    5457/* Push an item on the tail of the list.
     
    5659 * Returns: -1 if the list is full, 0 on success
    5760 */
    58 int push_tail_list (SH_FIFO * fifo, char * indat, int in_i, const char * in_str);
     61int push_tail_list (SH_FIFO * fifo, const char * indat, int in_i, const char * in_str);
     62#define sh_fifo_push_tail(a, b) push_tail_list((a), (b), 0, NULL)
    5963
    6064/* pop an item from the tail of the list
     
    6468 */
    6569char * pop_list (SH_FIFO * fifo);
     70#define sh_fifo_pop(a) pop_list((a))
    6671
     72/* ----  Special functions -------------------------------------------------*/
    6773
     74/* This is for eMail where different recipients may be eligible for         *
     75 * different subsets of messages. We need to delete all that were sent      *
     76 * to all intended recipients, and keep all with at least one failure.      */
     77
     78/* Iterate over list and check for each if it is valid for 'tag';
     79 * i.e. (item->s_extra == tag). If yes, add to the returned string.
     80 * If (okNull == False) then item->s_xtra must be defined
     81 */
    6882sh_string * tag_list (SH_FIFO * fifo, char * tag,
    6983                      int(*check)(int, const char*, const char*, const void*),
    7084                      const void * info, int okNull);
     85
     86/* Flag all tagged as candidate to keep */
    7187void rollback_list (SH_FIFO * fifo);
     88/* Flag all tagged as candidate to delete */
    7289void mark_list (SH_FIFO * fifo);
     90/* Remove all flags */
    7391void reset_list (SH_FIFO * fifo);
     92/* Delete all marked for delete that are not flagged for keep */
    7493int commit_list (SH_FIFO * fifo);
    7594
Note: See TracChangeset for help on using the changeset viewer.