Blame view

tools/sctk-2.4.10/src/sclite/delarc1.c 1.17 KB
8dcb6dfcb   Yannick Estève   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  /* file delarc1.c */
  
  
  #include "sctk.h"
  
  ARC_LIST_ATOM *del_from_arc_list(ARC_LIST_ATOM **plist, ARC *arc, int *perr)
                                             
  
  /*******************************************************************/
  /* Plist is the address of a pointer to an arc list.  Deletes the  */
  /* arc pointed to by *arc from this list, modifying *plist if      */
  /* needed.                                                         */
  /* DOES NOT free the arc itself, since it may be pointed to by     */
  /* another arc pointer.                                            */
  /* Returns pointer to the new list.                                */
  /*******************************************************************/
  
   {char *proc = "del_from_arc_list";
    ARC_LIST_ATOM *p, *p_next;
  /* code */
    db_enter_msg(proc,1); /* debug only */
    *perr = 0;
    for (p = *plist; p != NULL; p = p_next)
      {p_next = p->next;
       if (p->arc == arc)
         {if (p->next != NULL) p->next->prev = p->prev;
          if (p->prev != NULL) p->prev->next = p->next;
          else *plist = p->next;
          free(p);
      }  }
    db_leave_msg(proc,1); /* debug only */
    return *plist;
   } /* end del_from_arc_list() */