Changeset 420 for trunk/Jgraph/list.c


Ignore:
Timestamp:
02/27/08 07:13:31 (13 years ago)
Author:
Nicholas Riley
Message:

Jgraph: my changes - ANSIfication, few minor bug fixes; works on OS X 10.5 now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Jgraph/list.c

    r418 r420  
    77
    88#include <stdio.h>    /* Basic includes and definitions */
     9#include <stdlib.h>
    910#include "list.h"
    1011
     
    3334} *Int_list;
    3435
    35 insert(item, list)      /* Inserts to the end of a list */
    36 List item;
    37 List list;
     36void insert(void *item, void *list)     /* Inserts to the end of a list */
    3837{
    3938  List last_node;
    4039
    41   last_node = list->blink;
     40  last_node = ((List)list)->blink;
    4241
    43   list->blink = item;
     42  ((List)list)->blink = item;
    4443  last_node->flink = item;
    45   item->blink = last_node;
    46   item->flink = list;
     44  ((List)item)->blink = last_node;
     45  ((List)item)->flink = list;
    4746}
    4847
    49 delete_item(item)               /* Deletes an arbitrary iterm */
    50 List item;
     48void delete_item(void *item)            /* Deletes an arbitrary iterm */
    5149{
    52   item->flink->blink = item->blink;
    53   item->blink->flink = item->flink;
     50  ((List)item)->flink->blink = ((List)item)->blink;
     51  ((List)item)->blink->flink = ((List)item)->flink;
    5452}
    5553
     
    6866}
    6967 
    70 List get_node(list)   /* Allocates a node to be inserted into the list */
    71 List list;
     68List get_node(void *list)   /* Allocates a node to be inserted into the list */
    7269{
    7370  Int_list l;
     
    8481}
    8582
    86 free_node(node, list)    /* Deallocates a node from the list */
    87 List node;
    88 List list;
     83void free_node(void *node, void *list)    /* Deallocates a node from the list */
    8984{
    9085  Int_list l;
    9186 
    9287  l = (Int_list) list;
    93   node->flink = l->free_list;
     88  ((List)node)->flink = l->free_list;
    9489  l->free_list = node;
    9590}
Note: See TracChangeset for help on using the changeset viewer.