stored_playlist: no CamelCase
Renamed all public functions, prefix is "spl_".
This commit is contained in:
		@@ -544,7 +544,7 @@ static int handleRename(struct client *client,
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	enum playlist_result result;
 | 
						enum playlist_result result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	result = renameStoredPlaylist(argv[1], argv[2]);
 | 
						result = spl_rename(argv[1], argv[2]);
 | 
				
			||||||
	return print_playlist_result(client, result);
 | 
						return print_playlist_result(client, result);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -718,7 +718,7 @@ static int handlePlaylistDelete(struct client *client,
 | 
				
			|||||||
	if (check_int(client, &from, argv[2], check_integer, argv[2]) < 0)
 | 
						if (check_int(client, &from, argv[2], check_integer, argv[2]) < 0)
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	result = removeOneSongFromStoredPlaylistByPath(playlist, from);
 | 
						result = spl_remove_index(playlist, from);
 | 
				
			||||||
	return print_playlist_result(client, result);
 | 
						return print_playlist_result(client, result);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -734,7 +734,7 @@ static int handlePlaylistMove(struct client *client,
 | 
				
			|||||||
	if (check_int(client, &to, argv[3], check_integer, argv[3]) < 0)
 | 
						if (check_int(client, &to, argv[3], check_integer, argv[3]) < 0)
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	result = moveSongInStoredPlaylistByPath(playlist, from, to);
 | 
						result = spl_move_index(playlist, from, to);
 | 
				
			||||||
	return print_playlist_result(client, result);
 | 
						return print_playlist_result(client, result);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -208,7 +208,7 @@ directoryAddSongToStoredPlaylist(struct song *song, void *_data)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	struct add_data *data = _data;
 | 
						struct add_data *data = _data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (appendSongToStoredPlaylistByPath(data->path, song) != 0)
 | 
						if (spl_append_song(data->path, song) != 0)
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -220,7 +220,7 @@ void clearPlaylist(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int clearStoredPlaylist(const char *utf8file)
 | 
					int clearStoredPlaylist(const char *utf8file)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return removeAllFromStoredPlaylistByPath(utf8file);
 | 
						return spl_clear(utf8file);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void showPlaylist(struct client *client)
 | 
					void showPlaylist(struct client *client)
 | 
				
			||||||
@@ -583,14 +583,14 @@ int addToStoredPlaylist(const char *url, const char *utf8file)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	song = db_get_song(url);
 | 
						song = db_get_song(url);
 | 
				
			||||||
	if (song)
 | 
						if (song)
 | 
				
			||||||
		return appendSongToStoredPlaylistByPath(utf8file, song);
 | 
							return spl_append_song(utf8file, song);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!isValidRemoteUtf8Url(url))
 | 
						if (!isValidRemoteUtf8Url(url))
 | 
				
			||||||
		return ACK_ERROR_NO_EXIST;
 | 
							return ACK_ERROR_NO_EXIST;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	song = song_remote_new(url);
 | 
						song = song_remote_new(url);
 | 
				
			||||||
	if (song) {
 | 
						if (song) {
 | 
				
			||||||
		int ret = appendSongToStoredPlaylistByPath(utf8file, song);
 | 
							int ret = spl_append_song(utf8file, song);
 | 
				
			||||||
		song_free(song);
 | 
							song_free(song);
 | 
				
			||||||
		return ret;
 | 
							return ret;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -1343,7 +1343,7 @@ int PlaylistInfo(struct client *client, const char *utf8file, int detail)
 | 
				
			|||||||
	ListNode *node;
 | 
						ListNode *node;
 | 
				
			||||||
	List *list;
 | 
						List *list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(list = loadStoredPlaylist(utf8file)))
 | 
						if (!(list = spl_load(utf8file)))
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	node = list->firstNode;
 | 
						node = list->firstNode;
 | 
				
			||||||
@@ -1375,7 +1375,7 @@ enum playlist_result loadPlaylist(struct client *client, const char *utf8file)
 | 
				
			|||||||
	ListNode *node;
 | 
						ListNode *node;
 | 
				
			||||||
	List *list;
 | 
						List *list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(list = loadStoredPlaylist(utf8file)))
 | 
						if (!(list = spl_load(utf8file)))
 | 
				
			||||||
		return PLAYLIST_RESULT_NO_SUCH_LIST;
 | 
							return PLAYLIST_RESULT_NO_SUCH_LIST;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	node = list->firstNode;
 | 
						node = list->firstNode;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,8 @@
 | 
				
			|||||||
#include "idle.h"
 | 
					#include "idle.h"
 | 
				
			||||||
#include "os_compat.h"
 | 
					#include "os_compat.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ListNode *nodeOfStoredPlaylist(List *list, int idx)
 | 
					static ListNode *
 | 
				
			||||||
 | 
					spl_get_index(List *list, int idx)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int forward;
 | 
						int forward;
 | 
				
			||||||
	ListNode *node;
 | 
						ListNode *node;
 | 
				
			||||||
@@ -63,7 +64,7 @@ static ListNode *nodeOfStoredPlaylist(List *list, int idx)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static enum playlist_result
 | 
					static enum playlist_result
 | 
				
			||||||
writeStoredPlaylistToPath(List *list, const char *utf8path)
 | 
					spl_save(List *list, const char *utf8path)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ListNode *node;
 | 
						ListNode *node;
 | 
				
			||||||
	FILE *file;
 | 
						FILE *file;
 | 
				
			||||||
@@ -87,7 +88,8 @@ writeStoredPlaylistToPath(List *list, const char *utf8path)
 | 
				
			|||||||
	return PLAYLIST_RESULT_SUCCESS;
 | 
						return PLAYLIST_RESULT_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
List *loadStoredPlaylist(const char *utf8path)
 | 
					List *
 | 
				
			||||||
 | 
					spl_load(const char *utf8path)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	List *list;
 | 
						List *list;
 | 
				
			||||||
	FILE *file;
 | 
						FILE *file;
 | 
				
			||||||
@@ -136,7 +138,8 @@ List *loadStoredPlaylist(const char *utf8path)
 | 
				
			|||||||
	return list;
 | 
						return list;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int moveSongInStoredPlaylist(List *list, int src, int dest)
 | 
					static int
 | 
				
			||||||
 | 
					spl_move_index_internal(List *list, int src, int dest)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ListNode *srcNode, *destNode;
 | 
						ListNode *srcNode, *destNode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -144,11 +147,11 @@ static int moveSongInStoredPlaylist(List *list, int src, int dest)
 | 
				
			|||||||
	    src < 0 || dest < 0 || src == dest)
 | 
						    src < 0 || dest < 0 || src == dest)
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	srcNode = nodeOfStoredPlaylist(list, src);
 | 
						srcNode = spl_get_index(list, src);
 | 
				
			||||||
	if (!srcNode)
 | 
						if (!srcNode)
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	destNode = nodeOfStoredPlaylist(list, dest);
 | 
						destNode = spl_get_index(list, dest);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* remove src */
 | 
						/* remove src */
 | 
				
			||||||
	if (srcNode->prevNode)
 | 
						if (srcNode->prevNode)
 | 
				
			||||||
@@ -198,20 +201,20 @@ static int moveSongInStoredPlaylist(List *list, int src, int dest)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum playlist_result
 | 
					enum playlist_result
 | 
				
			||||||
moveSongInStoredPlaylistByPath(const char *utf8path, int src, int dest)
 | 
					spl_move_index(const char *utf8path, int src, int dest)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	List *list;
 | 
						List *list;
 | 
				
			||||||
	enum playlist_result result;
 | 
						enum playlist_result result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(list = loadStoredPlaylist(utf8path)))
 | 
						if (!(list = spl_load(utf8path)))
 | 
				
			||||||
		return PLAYLIST_RESULT_NO_SUCH_LIST;
 | 
							return PLAYLIST_RESULT_NO_SUCH_LIST;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (moveSongInStoredPlaylist(list, src, dest) != 0) {
 | 
						if (spl_move_index_internal(list, src, dest) != 0) {
 | 
				
			||||||
		freeList(list);
 | 
							freeList(list);
 | 
				
			||||||
		return PLAYLIST_RESULT_BAD_RANGE;
 | 
							return PLAYLIST_RESULT_BAD_RANGE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	result = writeStoredPlaylistToPath(list, utf8path);
 | 
						result = spl_save(list, utf8path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	freeList(list);
 | 
						freeList(list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -220,7 +223,7 @@ moveSongInStoredPlaylistByPath(const char *utf8path, int src, int dest)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum playlist_result
 | 
					enum playlist_result
 | 
				
			||||||
removeAllFromStoredPlaylistByPath(const char *utf8path)
 | 
					spl_clear(const char *utf8path)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char filename[MPD_PATH_MAX];
 | 
						char filename[MPD_PATH_MAX];
 | 
				
			||||||
	FILE *file;
 | 
						FILE *file;
 | 
				
			||||||
@@ -240,9 +243,10 @@ removeAllFromStoredPlaylistByPath(const char *utf8path)
 | 
				
			|||||||
	return PLAYLIST_RESULT_SUCCESS;
 | 
						return PLAYLIST_RESULT_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int removeOneSongFromStoredPlaylist(List *list, int pos)
 | 
					static int
 | 
				
			||||||
 | 
					spl_remove_index_internal(List *list, int pos)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ListNode *node = nodeOfStoredPlaylist(list, pos);
 | 
						ListNode *node = spl_get_index(list, pos);
 | 
				
			||||||
	if (!node)
 | 
						if (!node)
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -252,20 +256,20 @@ static int removeOneSongFromStoredPlaylist(List *list, int pos)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum playlist_result
 | 
					enum playlist_result
 | 
				
			||||||
removeOneSongFromStoredPlaylistByPath(const char *utf8path, int pos)
 | 
					spl_remove_index(const char *utf8path, int pos)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	List *list;
 | 
						List *list;
 | 
				
			||||||
	enum playlist_result result;
 | 
						enum playlist_result result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(list = loadStoredPlaylist(utf8path)))
 | 
						if (!(list = spl_load(utf8path)))
 | 
				
			||||||
		return PLAYLIST_RESULT_NO_SUCH_LIST;
 | 
							return PLAYLIST_RESULT_NO_SUCH_LIST;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (removeOneSongFromStoredPlaylist(list, pos) != 0) {
 | 
						if (spl_remove_index_internal(list, pos) != 0) {
 | 
				
			||||||
		freeList(list);
 | 
							freeList(list);
 | 
				
			||||||
		return PLAYLIST_RESULT_BAD_RANGE;
 | 
							return PLAYLIST_RESULT_BAD_RANGE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	result = writeStoredPlaylistToPath(list, utf8path);
 | 
						result = spl_save(list, utf8path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	freeList(list);
 | 
						freeList(list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -274,7 +278,7 @@ removeOneSongFromStoredPlaylistByPath(const char *utf8path, int pos)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum playlist_result
 | 
					enum playlist_result
 | 
				
			||||||
appendSongToStoredPlaylistByPath(const char *utf8path, struct song *song)
 | 
					spl_append_song(const char *utf8path, struct song *song)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	FILE *file;
 | 
						FILE *file;
 | 
				
			||||||
	struct stat st;
 | 
						struct stat st;
 | 
				
			||||||
@@ -313,7 +317,7 @@ appendSongToStoredPlaylistByPath(const char *utf8path, struct song *song)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum playlist_result
 | 
					enum playlist_result
 | 
				
			||||||
renameStoredPlaylist(const char *utf8from, const char *utf8to)
 | 
					spl_rename(const char *utf8from, const char *utf8to)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct stat st;
 | 
						struct stat st;
 | 
				
			||||||
	char from[MPD_PATH_MAX];
 | 
						char from[MPD_PATH_MAX];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,21 +24,22 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
struct song;
 | 
					struct song;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
List *loadStoredPlaylist(const char *utf8path);
 | 
					List *
 | 
				
			||||||
 | 
					spl_load(const char *utf8path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum playlist_result
 | 
					enum playlist_result
 | 
				
			||||||
moveSongInStoredPlaylistByPath(const char *utf8path, int src, int dest);
 | 
					spl_move_index(const char *utf8path, int src, int dest);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum playlist_result
 | 
					enum playlist_result
 | 
				
			||||||
removeAllFromStoredPlaylistByPath(const char *utf8path);
 | 
					spl_clear(const char *utf8path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum playlist_result
 | 
					enum playlist_result
 | 
				
			||||||
removeOneSongFromStoredPlaylistByPath(const char *utf8path, int pos);
 | 
					spl_remove_index(const char *utf8path, int pos);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum playlist_result
 | 
					enum playlist_result
 | 
				
			||||||
appendSongToStoredPlaylistByPath(const char *utf8path, struct song *song);
 | 
					spl_append_song(const char *utf8path, struct song *song);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum playlist_result
 | 
					enum playlist_result
 | 
				
			||||||
renameStoredPlaylist(const char *utf8from, const char *utf8to);
 | 
					spl_rename(const char *utf8from, const char *utf8to);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user