Logo Search packages:      
Sourcecode: jclassinfo version File versions  Download package

void string_list_remove_all ( StringList *  list,
int  flag 
)

string_list_remove_all : The list to remove the strings from. : The flag to remove.

Removes all strings matching the given flag. Any string that has additional flags will not be removed but it will have the given flag unset.

Definition at line 258 of file string_list.c.

{
      struct string_node* prev;
      struct string_node* curr;
      
      curr = list->head;
      prev = NULL;
      
      while(curr != NULL)
      {
            if(curr->flag & flag)
            {
                  curr->flag &= ~flag;
                  if (!curr->flag)
                  {
                        if(curr == list->head)
                        {
                              list->head = curr->next;
                              free(curr->string);
                              free(curr);
                              curr = list->head;
                              prev = NULL;
                        }
                        else
                        {
                              prev->next = curr->next;
                              free(curr->string);
                              free(curr);
                              curr = prev->next;
                        }
                  }
            }
            else
            {
                  prev = curr;
                  curr = curr->next;
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index