[CLEANUP] Remove unused code
Static what makes sense git-svn-id: https://svn.musicpd.org/mpd/trunk@4329 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
75789d1490
commit
7154c510e5
69
src/list.c
69
src/list.c
@ -25,7 +25,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void makeListNodesArray(List * list) {
|
static void makeListNodesArray(List * list) {
|
||||||
ListNode * node = list->firstNode;
|
ListNode * node = list->firstNode;
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ void makeListNodesArray(List * list) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void freeListNodesArray(List * list) {
|
static void freeListNodesArray(List * list) {
|
||||||
if(!list->nodesArray) return;
|
if(!list->nodesArray) return;
|
||||||
free(list->nodesArray);
|
free(list->nodesArray);
|
||||||
list->nodesArray = NULL;
|
list->nodesArray = NULL;
|
||||||
@ -193,7 +193,9 @@ int insertInListWithoutKey(List * list, void * data) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int findNodeInList(List * list, char * key, ListNode ** node, int * pos) {
|
/* if _key_ is not found, *_node_ is assigned to the node before which
|
||||||
|
the info would be found */
|
||||||
|
static int findNodeInList(List * list, char * key, ListNode ** node, int * pos) {
|
||||||
long high;
|
long high;
|
||||||
long low;
|
long low;
|
||||||
long cur;
|
long cur;
|
||||||
@ -342,32 +344,7 @@ void freeList(void * list) {
|
|||||||
free(list);
|
free(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearList(List * list) {
|
static void swapNodes(ListNode * nodeA, ListNode * nodeB) {
|
||||||
ListNode * tmpNode;
|
|
||||||
ListNode * tmpNode2;
|
|
||||||
|
|
||||||
assert(list!=NULL);
|
|
||||||
|
|
||||||
tmpNode = ((List *)list)->firstNode;
|
|
||||||
|
|
||||||
while(tmpNode!=NULL) {
|
|
||||||
tmpNode2 = tmpNode->nextNode;
|
|
||||||
if(list->strdupKeys) free(tmpNode->key);
|
|
||||||
if(((List *)list)->freeDataFunc) {
|
|
||||||
((List *)list)->freeDataFunc(tmpNode->data);
|
|
||||||
}
|
|
||||||
free(tmpNode);
|
|
||||||
tmpNode = tmpNode2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(list->nodesArray) freeListNodesArray(list);
|
|
||||||
|
|
||||||
list->firstNode = NULL;
|
|
||||||
list->lastNode = NULL;
|
|
||||||
list->numberOfNodes = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void swapNodes(ListNode * nodeA, ListNode * nodeB) {
|
|
||||||
char * key;
|
char * key;
|
||||||
void * data;
|
void * data;
|
||||||
|
|
||||||
@ -384,37 +361,7 @@ void swapNodes(ListNode * nodeA, ListNode * nodeB) {
|
|||||||
nodeA->data = data;
|
nodeA->data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void moveNodeAfter(List * list, ListNode * moveNode, ListNode * beforeNode) {
|
static void bubbleSort(ListNode ** nodesArray, long start, long end) {
|
||||||
ListNode * prev;
|
|
||||||
ListNode * next;
|
|
||||||
|
|
||||||
assert(moveNode!=NULL);
|
|
||||||
|
|
||||||
prev = moveNode->prevNode;
|
|
||||||
next = moveNode->nextNode;
|
|
||||||
|
|
||||||
if(prev) prev->nextNode = next;
|
|
||||||
else list->firstNode = next;
|
|
||||||
if(next) next->prevNode = prev;
|
|
||||||
else list->lastNode = prev;
|
|
||||||
|
|
||||||
if(beforeNode) {
|
|
||||||
next = beforeNode->nextNode;
|
|
||||||
moveNode->nextNode = next;
|
|
||||||
moveNode->prevNode = beforeNode;
|
|
||||||
next->prevNode = moveNode;
|
|
||||||
beforeNode->nextNode = moveNode;
|
|
||||||
if(beforeNode==list->lastNode) list->lastNode = moveNode;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
moveNode->prevNode = NULL;
|
|
||||||
moveNode->nextNode = list->firstNode;
|
|
||||||
list->firstNode = moveNode;
|
|
||||||
if(list->lastNode==NULL) list->lastNode = moveNode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void bubbleSort(ListNode ** nodesArray, long start, long end) {
|
|
||||||
long i;
|
long i;
|
||||||
long j;
|
long j;
|
||||||
ListNode * node;
|
ListNode * node;
|
||||||
@ -431,7 +378,7 @@ void bubbleSort(ListNode ** nodesArray, long start, long end) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void quickSort(ListNode ** nodesArray, long start, long end) {
|
static void quickSort(ListNode ** nodesArray, long start, long end) {
|
||||||
if(start>=end) return;
|
if(start>=end) return;
|
||||||
else if(end-start<5) bubbleSort(nodesArray,start,end);
|
else if(end-start<5) bubbleSort(nodesArray,start,end);
|
||||||
else {
|
else {
|
||||||
|
@ -97,17 +97,12 @@ void deleteNodeFromList(List * list,ListNode * node);
|
|||||||
*/
|
*/
|
||||||
int findInList(List * list, char * key, void ** data);
|
int findInList(List * list, char * key, void ** data);
|
||||||
|
|
||||||
/* if _key_ is not found, *_node_ is assigned to the node before which
|
|
||||||
the info would be found */
|
|
||||||
int findNodeInList(List * list, char * key, ListNode ** node, int * pos);
|
|
||||||
|
|
||||||
/* frees memory malloc'd for list and its nodes
|
/* frees memory malloc'd for list and its nodes
|
||||||
* _list_ -> List to be free'd
|
* _list_ -> List to be free'd
|
||||||
*/
|
*/
|
||||||
void freeList(void * list);
|
void freeList(void * list);
|
||||||
|
|
||||||
void clearList(List * list);
|
|
||||||
|
|
||||||
void sortList(List * list);
|
void sortList(List * list);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user