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

void string_list_remove ( StringList list,
const char *  dead_string,
int  flag 
)

string_list_remove : The list to remove the string from. : The string to remove. : The flag of the string to remove.

Removes a string from the list. If the string has more flags set it will not be removed but the given flag will be unset.

Definition at line 206 of file string_list.c.

References StringList::head.

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

Generated by  Doxygen 1.6.0   Back to index