lib/shaRes.c File Reference

#include "common.h"
#include "shaRes.h"

Include dependency graph for shaRes.c:

Go to the source code of this file.

Functions

static void shaFreeNode (struct shaResNode *node)
void shaUnlink (struct shaResNode *node)
void shaLink (struct shaResNode *node)
shaResNodeshaNewNode (struct shaResList *list, char *name, void *data)
void shaCleanup (struct shaResList *list)
void shaInit (struct shaResList *list, void(*freeData)(void *pData))

Variables

static char const rcsid [] = "$Id: shaRes.c,v 1.4 2003/05/06 07:33:44 kate Exp $"


Function Documentation

void shaCleanup ( struct shaResList list  ) 

Definition at line 63 of file shaRes.c.

References shaResList::head, shaResNode::list, shaResNode::next, and shaFreeNode().

00065 {
00066 struct shaResNode *node, *next;
00067 
00068 for (node = list->head;node != NULL;node = next)
00069     {
00070     next = node->next;
00071     shaFreeNode(node);
00072     }
00073 list->head = NULL;
00074 }

Here is the call graph for this function:

static void shaFreeNode ( struct shaResNode node  )  [static]

Definition at line 11 of file shaRes.c.

References shaResNode::data, shaResList::freeData, freeMem(), shaResList::head, shaResNode::list, shaResNode::name, shaResNode::next, and shaResNode::prev.

Referenced by shaCleanup(), and shaUnlink().

00013 {
00014 struct shaResNode *next = node->next;
00015 struct shaResNode *prev = node->prev;
00016 struct shaResList *list = node->list;
00017 
00018 if (next != NULL)
00019     next->prev = prev;
00020 if (prev != NULL)
00021     prev->next = next;
00022 else
00023     list->head = next;
00024 list->freeData(node->data);
00025 freeMem(node->name);
00026 freeMem(node);
00027 }        

Here is the call graph for this function:

Here is the caller graph for this function:

void shaInit ( struct shaResList list,
void(*)(void *pData)  freeData 
)

Definition at line 76 of file shaRes.c.

References shaResList::freeData, shaResList::head, and shaResNode::list.

00078 {
00079 list->head = NULL;
00080 list->freeData = freeData;
00081 }

void shaLink ( struct shaResNode node  ) 

Definition at line 36 of file shaRes.c.

References shaResNode::links.

00038 {
00039 ++node->links;
00040 }

struct shaResNode* shaNewNode ( struct shaResList list,
char *  name,
void *  data 
) [read]

Definition at line 42 of file shaRes.c.

References cloneString(), shaResList::head, shaResNode::list, needMem(), and shaResNode::prev.

00044 {
00045 struct shaResNode *nn = needMem(sizeof(*nn));
00046 struct shaResNode *head = list->head;
00047 
00048 /* Store the goods and what list we're on, and start with one link. */
00049 nn->list = list;
00050 nn->data = data;
00051 nn->links = 1;
00052 nn->name = cloneString(name);
00053 
00054 /* Put us at the front of the list. */
00055 nn->next = head;
00056 nn->prev = NULL;
00057 if (head != NULL)
00058     head->prev = nn;
00059 list->head = nn;
00060 return nn;
00061 }

Here is the call graph for this function:

void shaUnlink ( struct shaResNode node  ) 

Definition at line 29 of file shaRes.c.

References shaResNode::links, and shaFreeNode().

00031 {
00032 if (--node->links <= 0)
00033     shaFreeNode(node);
00034 }

Here is the call graph for this function:


Variable Documentation

char const rcsid[] = "$Id: shaRes.c,v 1.4 2003/05/06 07:33:44 kate Exp $" [static]

Definition at line 9 of file shaRes.c.


Generated on Tue Dec 25 20:16:22 2007 for blat by  doxygen 1.5.2