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

char* string_list_remove_first ( StringList list,
int  flag 

string_list_remove_first : The list containing the string. : The flag of the string.

Removes and returns the first string matching the given flag. If the string has more flags set the flag will be unset and the string will not be removed. String which have the IS_FINISHED_FLAG set will be ignored.

Returns: A copy of the string allocated with malloc.

Definition at line 108 of file string_list.c.

References StringList::head.

      struct string_node *curr, *prev;
      char* node_string;
      curr = list->head;
      prev = NULL;

      while(curr != NULL && (!(curr->flag & flag) || curr->flag & IS_FINISHED))
            prev = curr;
            curr = curr->next;

      if(curr == NULL)
            return NULL;
      curr->flag &= ~flag;
      node_string = strdup(curr->string);

            if(curr == list->head)
                  list->head = curr->next;
                  prev->next = curr->next;

      return node_string;

Generated by  Doxygen 1.6.0   Back to index