[CLEANUP] Cleanup whitespace->tabs
Remove dead code Static where possible git-svn-id: https://svn.musicpd.org/mpd/trunk@4345 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
		| @@ -40,7 +40,7 @@ typedef struct tagTrackerItem { | |||||||
| 	mpd_sint8 visited; | 	mpd_sint8 visited; | ||||||
| } TagTrackerItem; | } TagTrackerItem; | ||||||
|  |  | ||||||
| int keyCompare(const void *a, const void *b, void *data) { | static int keyCompare(const void *a, const void *b, void *data) { | ||||||
| 	return strcmp(a,b); | 	return strcmp(a,b); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -50,9 +50,6 @@ char * getTagItemString(int type, char * string) { | |||||||
| 	char *key; | 	char *key; | ||||||
| 	char **keyPointer = &key; | 	char **keyPointer = &key; | ||||||
|  |  | ||||||
|  |  | ||||||
| 	/*if(type == TAG_ITEM_TITLE) return strdup(string);*/ |  | ||||||
|  |  | ||||||
| 	if(tagLists[type] == NULL) { | 	if(tagLists[type] == NULL) { | ||||||
| 		tagLists[type] = g_tree_new_full(keyCompare, NULL, free, free); | 		tagLists[type] = g_tree_new_full(keyCompare, NULL, free, free); | ||||||
| 	} | 	} | ||||||
| @@ -66,8 +63,6 @@ char * getTagItemString(int type, char * string) { | |||||||
| 		item->visited = 0; | 		item->visited = 0; | ||||||
| 		key = strdup(string); | 		key = strdup(string); | ||||||
| 		g_tree_insert(tagLists[type], key, item); | 		g_tree_insert(tagLists[type], key, item); | ||||||
| 		 |  | ||||||
| 				 |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return key; | 	return key; | ||||||
| @@ -107,7 +102,8 @@ int getNumberOfTagItems(int type) { | |||||||
|  |  | ||||||
| 	return g_tree_nnodes(tagLists[type]); | 	return g_tree_nnodes(tagLists[type]); | ||||||
| } | } | ||||||
| int calcSavedMemory(char *key, TagTrackerItem* value, int* sum) { |  | ||||||
|  | static int calcSavedMemory(char *key, TagTrackerItem* value, int* sum) { | ||||||
| 	*sum -= sizeof(int) + 4*sizeof(void*); /* sizeof(_GTreeNode) */ | 	*sum -= sizeof(int) + 4*sizeof(void*); /* sizeof(_GTreeNode) */ | ||||||
| 	*sum -= sizeof(TagTrackerItem); | 	*sum -= sizeof(TagTrackerItem); | ||||||
| 	*sum += (strlen(key)+1)*value->count; | 	*sum += (strlen(key)+1)*value->count; | ||||||
| @@ -128,23 +124,11 @@ void printMemorySavedByTagTracker() { | |||||||
| 	DEBUG("saved memory from tags: %li\n", (long)sum); | 	DEBUG("saved memory from tags: %li\n", (long)sum); | ||||||
| } | } | ||||||
|  |  | ||||||
| void sortTagTrackerInfo() { | static int resetVisitedFlag(char *key, TagTrackerItem *value, void *data) { | ||||||
| 	/* implicit sorting |  | ||||||
| 	int i; |  | ||||||
|  |  | ||||||
| 	for(i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) { |  | ||||||
| 		if(!tagLists[i]) continue; |  | ||||||
|  |  | ||||||
| 		DEBUG("sorting %s info\n", mpdTagItemKeys[i]); |  | ||||||
|  |  | ||||||
| 		sortList(tagLists[i]); |  | ||||||
| 	}*/ |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int resetVisitedFlag(char *key, TagTrackerItem *value, void *data) { |  | ||||||
| 	value->visited = 0; | 	value->visited = 0; | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
| } | } | ||||||
|  |  | ||||||
| void resetVisitedFlagsInTagTracker(int type) { | void resetVisitedFlagsInTagTracker(int type) { | ||||||
|  |  | ||||||
| 	if(!tagLists[type]) return; | 	if(!tagLists[type]) return; | ||||||
| @@ -152,16 +136,6 @@ void resetVisitedFlagsInTagTracker(int type) { | |||||||
| 	g_tree_foreach(tagLists[type], (GTraverseFunc)resetVisitedFlag, NULL); | 	g_tree_foreach(tagLists[type], (GTraverseFunc)resetVisitedFlag, NULL); | ||||||
| } | } | ||||||
|  |  | ||||||
| int wasVisitedInTagTracker(int type, char * str) { |  | ||||||
| 	TagTrackerItem * item; |  | ||||||
|  |  | ||||||
| 	if(!tagLists[type]) return 0; |  | ||||||
|  |  | ||||||
| 	if(!(item = g_tree_lookup(tagLists[type], str))) return 0; |  | ||||||
|  |  | ||||||
| 	return item->visited; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void visitInTagTracker(int type, char * str) { | void visitInTagTracker(int type, char * str) { | ||||||
| 	TagTrackerItem * item; | 	TagTrackerItem * item; | ||||||
|  |  | ||||||
| @@ -177,7 +151,7 @@ struct _PrintVisitedUserdata { | |||||||
| 	char *type; | 	char *type; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| int printVisitedFlag(char *key, TagTrackerItem* value, struct _PrintVisitedUserdata *data) { | static int printVisitedFlag(char *key, TagTrackerItem* value, struct _PrintVisitedUserdata *data) { | ||||||
| 	if(value->visited) myfprintf(data->fp, "%s: %s\n", data->type, key); | 	if(value->visited) myfprintf(data->fp, "%s: %s\n", data->type, key); | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -30,12 +30,8 @@ int getNumberOfTagItems(int type); | |||||||
|  |  | ||||||
| void printMemorySavedByTagTracker(); | void printMemorySavedByTagTracker(); | ||||||
|  |  | ||||||
| void sortTagTrackerInfo(); |  | ||||||
|  |  | ||||||
| void resetVisitedFlagsInTagTracker(int type); | void resetVisitedFlagsInTagTracker(int type); | ||||||
|  |  | ||||||
| int wasVisitedInTagTracker(int type, char * str); |  | ||||||
|  |  | ||||||
| void visitInTagTracker(int type, char * str); | void visitInTagTracker(int type, char * str); | ||||||
|  |  | ||||||
| void printVisitedInTagTracker(FILE * fp, int type); | void printVisitedInTagTracker(FILE * fp, int type); | ||||||
|   | |||||||
							
								
								
									
										70
									
								
								src/tree.c
									
									
									
									
									
								
							
							
						
						
									
										70
									
								
								src/tree.c
									
									
									
									
									
								
							| @@ -1,70 +0,0 @@ | |||||||
| /* the Music Player Daemon (MPD) |  | ||||||
|  * (c)2003-2006 by Warren Dukes (warren.dukes@gmail.com) |  | ||||||
|  * This project's homepage is: http://www.musicpd.org |  | ||||||
|  * |  | ||||||
|  * This program is free software; you can redistribute it and/or modify |  | ||||||
|  * it under the terms of the GNU General Public License as published by |  | ||||||
|  * the Free Software Foundation; either version 2 of the License, or |  | ||||||
|  * (at your option) any later version. |  | ||||||
|  * |  | ||||||
|  * This program is distributed in the hope that it will be useful, |  | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |  | ||||||
|  * GNU General Public License for more details. |  | ||||||
|  * You should have received a copy of the GNU General Public License |  | ||||||
|  * along with this program; if not, write to the Free Software |  | ||||||
|  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #include "tree.h" |  | ||||||
|  |  | ||||||
| static inline TreeNode * newTreeNode() { |  | ||||||
| 	TreeNode * ret = malloc(sizeof(TreeNode)); |  | ||||||
|  |  | ||||||
| 	ret->data[0] = NULL; |  | ||||||
| 	ret->data[1] = NULL; |  | ||||||
|  |  | ||||||
| 	ret->children[0] = NULL; |  | ||||||
| 	ret->children[1] = NULL; |  | ||||||
| 	ret->children[2] = NULL; |  | ||||||
|  |  | ||||||
| 	return ret; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static inline void freeTreeNode(TreeNode * node) { |  | ||||||
| 	free(node); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| Tree * newTree(TreeFreeDataFunc * freeFunc, TreeCompareDataFunc * compareFunc) { |  | ||||||
| 	Tree * ret = malloc(sizeof(Tree)); |  | ||||||
|  |  | ||||||
| 	ret->headNode = NULL; |  | ||||||
| 	ret->freeFunc = freeFunc; |  | ||||||
| 	ret->compareFunc = compareFunc; |  | ||||||
|  |  | ||||||
| 	return ret; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void freeTree(Tree * tree) { |  | ||||||
| 	TreeIterator * iter = newTreeIterator(tree, POSTORDER); |  | ||||||
|  |  | ||||||
| 	TreeNode * node; |  | ||||||
|  |  | ||||||
| 	if(data->freeFunc) { |  | ||||||
| 		void * data; |  | ||||||
|  |  | ||||||
| 		while( ( data = nextTreeIterator(iter) ) ) { |  | ||||||
|  |  | ||||||
| 		} |  | ||||||
| 	 |  | ||||||
| 		freeTreeIterator(iter); |  | ||||||
|  |  | ||||||
| 		iter = newTreeIterator(tree, POSTORDER); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	while( ( node = nextNodeTreeIterator(iter) ) ) { |  | ||||||
| 		freeTreeNode(node); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	freeTreeIterator(iter); |  | ||||||
| } |  | ||||||
							
								
								
									
										71
									
								
								src/tree.h
									
									
									
									
									
								
							
							
						
						
									
										71
									
								
								src/tree.h
									
									
									
									
									
								
							| @@ -1,71 +0,0 @@ | |||||||
| /* the Music Player Daemon (MPD) |  | ||||||
|  * (c)2003-2006 by Warren Dukes (warren.dukes@gmail.com) |  | ||||||
|  * This project's homepage is: http://www.musicpd.org |  | ||||||
|  * |  | ||||||
|  * This program is free software; you can redistribute it and/or modify |  | ||||||
|  * it under the terms of the GNU General Public License as published by |  | ||||||
|  * the Free Software Foundation; either version 2 of the License, or |  | ||||||
|  * (at your option) any later version. |  | ||||||
|  * |  | ||||||
|  * This program is distributed in the hope that it will be useful, |  | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |  | ||||||
|  * GNU General Public License for more details. |  | ||||||
|  * You should have received a copy of the GNU General Public License |  | ||||||
|  * along with this program; if not, write to the Free Software |  | ||||||
|  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef TREE_H |  | ||||||
| #define TREE_H |  | ||||||
|  |  | ||||||
| typedef struct _TreeNode { |  | ||||||
| 	void * data[2]; |  | ||||||
| 	struct _TreeNode * children[3]; |  | ||||||
| 	struct _TreeNode * parent; |  | ||||||
| } TreeNode; |  | ||||||
|  |  | ||||||
| typedef struct _Tree { |  | ||||||
| 	TreeNode headNode; |  | ||||||
| 	TreeFreeDataFunc * freeFunc; |  | ||||||
| 	TreeCompareDataFunc * compareFunc; |  | ||||||
| } Tree; |  | ||||||
|  |  | ||||||
| typedef enum _TreeIteratorType { |  | ||||||
| 	PREORDER, |  | ||||||
| 	INORDER, |  | ||||||
| 	POSTORDER |  | ||||||
| } TreeIteratorType; |  | ||||||
|  |  | ||||||
| typedef struct _TreeIterator { |  | ||||||
| 	Data * data; |  | ||||||
| 	/* private data */ |  | ||||||
| 	TreeIteratorType type; |  | ||||||
| 	TreeNode * currentNode; |  | ||||||
| 	int pos; |  | ||||||
| } TreeIterator; |  | ||||||
|  |  | ||||||
| typedef int TreeCompareDataFunc(void * left, void * right); |  | ||||||
|  |  | ||||||
| typedef int TreeFreeDataFunc(void * data); |  | ||||||
|  |  | ||||||
| Tree * newTree(TreeFreeDataFunc * freeFunc, TreeCompareDataFunc * compareFunc); |  | ||||||
|  |  | ||||||
| void freeTree(Tree * tree); |  | ||||||
|  |  | ||||||
| int insertInTree(Tree * tree, void * data); |  | ||||||
|  |  | ||||||
| int deleteFromTree(Tree * tree, void * needle); |  | ||||||
|  |  | ||||||
| void * findInTree(Tree * tree, void * needle); |  | ||||||
|  |  | ||||||
| TreeIterator * newTreeIterator(Tree * tree, TreeIteratorType type); |  | ||||||
|  |  | ||||||
| /* will return the same pointer passed in on success |  | ||||||
|  * if NULL is returned, this indicates the end of tree |  | ||||||
|  */ |  | ||||||
| data * nextTreeIterator(TreeIterator * iter); |  | ||||||
|  |  | ||||||
| void freeTreeIterator(TreeIterator * iter); |  | ||||||
|  |  | ||||||
| #endif /* TREE_H */ |  | ||||||
| @@ -99,4 +99,3 @@ unsigned long readLEuint32(const unsigned char *p) | |||||||
| 		((unsigned long) p[1] << 8) | | 		((unsigned long) p[1] << 8) | | ||||||
| 		((unsigned long) p[2] << 16) | ((unsigned long) p[3] << 24); | 		((unsigned long) p[2] << 16) | ((unsigned long) p[3] << 24); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										42
									
								
								src/volume.c
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								src/volume.c
									
									
									
									
									
								
							| @@ -58,26 +58,26 @@ | |||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| int volume_mixerType = VOLUME_MIXER_TYPE_DEFAULT; | static int volume_mixerType = VOLUME_MIXER_TYPE_DEFAULT; | ||||||
| char * volume_mixerDevice = VOLUME_MIXER_DEVICE_DEFAULT; | static char * volume_mixerDevice = VOLUME_MIXER_DEVICE_DEFAULT; | ||||||
|  |  | ||||||
| int volume_softwareSet = 100; | static int volume_softwareSet = 100; | ||||||
|  |  | ||||||
| #ifdef HAVE_OSS | #ifdef HAVE_OSS | ||||||
| int volume_ossFd; | static int volume_ossFd; | ||||||
| int volume_ossControl = SOUND_MIXER_PCM; | static int volume_ossControl = SOUND_MIXER_PCM; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef HAVE_ALSA | #ifdef HAVE_ALSA | ||||||
| snd_mixer_t * volume_alsaMixerHandle = NULL; | static snd_mixer_t * volume_alsaMixerHandle = NULL; | ||||||
| snd_mixer_elem_t * volume_alsaElem; | static snd_mixer_elem_t * volume_alsaElem; | ||||||
| long volume_alsaMin; | static long volume_alsaMin; | ||||||
| long volume_alsaMax; | static long volume_alsaMax; | ||||||
| int volume_alsaSet = -1; | static int volume_alsaSet = -1; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef HAVE_OSS | #ifdef HAVE_OSS | ||||||
| int prepOssMixer(char * device) { | static int prepOssMixer(char * device) { | ||||||
| 	int devmask = 0; | 	int devmask = 0; | ||||||
| 	ConfigParam * param; | 	ConfigParam * param; | ||||||
|  |  | ||||||
| @@ -130,11 +130,11 @@ int prepOssMixer(char * device) { | |||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| void closeOssMixer() { | static void closeOssMixer() { | ||||||
| 	close(volume_ossFd); | 	close(volume_ossFd); | ||||||
| } | } | ||||||
|  |  | ||||||
| int getOssVolumeLevel() { | static int getOssVolumeLevel() { | ||||||
| 	int left, right, level; | 	int left, right, level; | ||||||
|  |  | ||||||
| 	if(ioctl(volume_ossFd,MIXER_READ(volume_ossControl),&level) < 0) { | 	if(ioctl(volume_ossFd,MIXER_READ(volume_ossControl),&level) < 0) { | ||||||
| @@ -153,7 +153,7 @@ int getOssVolumeLevel() { | |||||||
| 	return left; | 	return left; | ||||||
| } | } | ||||||
|  |  | ||||||
| int changeOssVolumeLevel(FILE * fp, int change, int rel) { | static int changeOssVolumeLevel(FILE * fp, int change, int rel) { | ||||||
| 	int current; | 	int current; | ||||||
| 	int new; | 	int new; | ||||||
| 	int level; | 	int level; | ||||||
| @@ -185,7 +185,7 @@ int changeOssVolumeLevel(FILE * fp, int change, int rel) { | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef HAVE_ALSA | #ifdef HAVE_ALSA | ||||||
| int prepAlsaMixer(char * card) { | static int prepAlsaMixer(char * card) { | ||||||
| 	int err; | 	int err; | ||||||
| 	snd_mixer_elem_t * elem; | 	snd_mixer_elem_t * elem; | ||||||
| 	char * controlName = VOLUME_MIXER_ALSA_CONTROL_DEFAULT; | 	char * controlName = VOLUME_MIXER_ALSA_CONTROL_DEFAULT; | ||||||
| @@ -250,11 +250,11 @@ int prepAlsaMixer(char * card) { | |||||||
| 	return -1; | 	return -1; | ||||||
| } | } | ||||||
|  |  | ||||||
| void closeAlsaMixer() { | static void closeAlsaMixer() { | ||||||
| 	snd_mixer_close(volume_alsaMixerHandle); | 	snd_mixer_close(volume_alsaMixerHandle); | ||||||
| } | } | ||||||
|  |  | ||||||
| int getAlsaVolumeLevel() { | static int getAlsaVolumeLevel() { | ||||||
| 	int ret; | 	int ret; | ||||||
| 	long level; | 	long level; | ||||||
| 	long max = volume_alsaMax; | 	long max = volume_alsaMax; | ||||||
| @@ -280,7 +280,7 @@ int getAlsaVolumeLevel() { | |||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
|  |  | ||||||
| int changeAlsaVolumeLevel(FILE * fp, int change, int rel) { | static int changeAlsaVolumeLevel(FILE * fp, int change, int rel) { | ||||||
| 	float vol; | 	float vol; | ||||||
| 	long level; | 	long level; | ||||||
| 	long test; | 	long test; | ||||||
| @@ -329,7 +329,7 @@ int changeAlsaVolumeLevel(FILE * fp, int change, int rel) { | |||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| int prepMixer(char * device) { | static int prepMixer(char * device) { | ||||||
| 	switch(volume_mixerType) { | 	switch(volume_mixerType) { | ||||||
| #ifdef HAVE_ALSA | #ifdef HAVE_ALSA | ||||||
| 	case VOLUME_MIXER_TYPE_ALSA: | 	case VOLUME_MIXER_TYPE_ALSA: | ||||||
| @@ -401,7 +401,7 @@ void openVolumeDevice() { | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| int getSoftwareVolume() { | static int getSoftwareVolume() { | ||||||
| 	return volume_softwareSet; | 	return volume_softwareSet; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -422,7 +422,7 @@ int getVolumeLevel() { | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| int changeSoftwareVolume(FILE * fp, int change, int rel) { | static int changeSoftwareVolume(FILE * fp, int change, int rel) { | ||||||
| 	int new = change; | 	int new = change; | ||||||
|  |  | ||||||
| 	if(rel) new+=volume_softwareSet; | 	if(rel) new+=volume_softwareSet; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Avuton Olrich
					Avuton Olrich