Ignore:
Timestamp:
11/26/18 17:32:17 (2 years ago)
Author:
Jacob Van Walraven <jcv9@…>
Branches:
develop
Children:
0a474e3
Parents:
f6f3ae5
Message:

More assertion cleanups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/data-struct/deque.c

    ree6e802 r88b9798  
    6363        ASSERT_RET(pthread_mutex_lock(&q->lock), == 0);
    6464        if (q->head == NULL) {
    65                 assert(q->tail == NULL && q->size == 0);
     65                /*assert(q->tail == NULL && q->size == 0);*/
     66                if (q->tail != NULL && q->size != 0) {
     67                        fprintf(stderr, "Error deque head cannot be NULL with a non NULL tail and size of more than 0 in libtrace_deque_push_back()\n");
     68                        return;
     69                }
    6670                new_node->prev = NULL;
    6771                q->head = q->tail = new_node;
    6872        } else {
    69                 assert (q->tail != NULL);
     73                /*assert (q->tail != NULL);*/
     74                if (q->tail == NULL) {
     75                        fprintf(stderr, "Error deque tail cannot be NULL if it contains a head in libtrace_deque_push_back()\n");
     76                        return;
     77                }
    7078                q->tail->next = new_node;
    7179                new_node->prev = q->tail; // Done the double link
     
    8694        ASSERT_RET(pthread_mutex_lock(&q->lock), == 0);
    8795        if (q->head == NULL) {
    88                 assert(q->tail == NULL && q->size == 0);
     96                /*assert(q->tail == NULL && q->size == 0);*/
     97                if (q->tail != NULL && q->size != 0) {
     98                        fprintf(stderr, "Error deque head cannot be NULL with a non NULL tail and size of more than 0 in libtrace_deque_push_front()\n");
     99                        return;
     100                }
    89101                new_node->next = NULL;
    90102                q->head = q->tail = new_node;
    91103        } else {
    92                 assert (q->head != NULL);
     104                /*assert (q->head != NULL);*/
     105                if (q->head == NULL) {
     106                        fprintf(stderr, "Error deque tail cannot be NULL if it contains a head in libtrace_deque_push_front()\n");
     107                        return;
     108                }
    93109                q->head->prev = new_node;
    94110                new_node->next = q->head; // Done the double link
Note: See TracChangeset for help on using the changeset viewer.