aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.h
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2006-07-30 03:43:38 +0000
committerEric Wong <normalperson@yhbt.net>2006-07-30 03:43:38 +0000
commit4cf5d04ca15bc28ee4636d1dccb858763513e571 (patch)
tree7898902e786f5763643a513ea96bcada8a2559cc /src/playlist.h
parent4d5b8509eb46cff40890b781018669233a79e414 (diff)
downloadmpd-4cf5d04ca15bc28ee4636d1dccb858763513e571.tar.gz
mpd-4cf5d04ca15bc28ee4636d1dccb858763513e571.tar.xz
mpd-4cf5d04ca15bc28ee4636d1dccb858763513e571.zip
interface/connection malloc reductions from mpd-ke
This patch massively reduces the amount of heap allocations at the interface/command layer. Most commands with minimal output should not allocate memory from the heap at all. Things like repeatedly polling status, currentsong, and volume changes should be faster as a result, and more importantly, not a source of memory fragmentation. These changes should be safe in that there's no way for a remote-client to corrupt memory or otherwise do bad stuff to MPD, but an extra set of eyes to review would be good. Of course there's never any warranty :) No longer do we use FILE * structures in the interface, which means we don't have to allocate any new memory for most connections. Now, before you go on about losing the buffering that FILE * +implies+, remember that myfprintf() never took advantage of any of the stdio buffering features. To reduce the diff and make bugs easier to spot in the diff, I've kept myfprintf in places where we write to files (and not network interfaces). Expect myfprintf to go away entirely soon (we'll use fprintf for writing regular files). git-svn-id: https://svn.musicpd.org/mpd/trunk@4483 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/playlist.h58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/playlist.h b/src/playlist.h
index faab10021..25ed45dfb 100644
--- a/src/playlist.h
+++ b/src/playlist.h
@@ -38,61 +38,61 @@ void readPlaylistState();
void savePlaylistState();
-int clearPlaylist(FILE * fp);
+int clearPlaylist(int fd);
-int addToPlaylist(FILE * fp, char *file, int printId);
+int addToPlaylist(int fd, char *file, int printId);
-int addSongToPlaylist(FILE * fp, Song * song, int printId);
+int addSongToPlaylist(int fd, Song * song, int printId);
-int showPlaylist(FILE * fp);
+int showPlaylist(int fd);
-int deleteFromPlaylist(FILE * fp, int song);
+int deleteFromPlaylist(int fd, int song);
-int deleteFromPlaylistById(FILE * fp, int song);
+int deleteFromPlaylistById(int fd, int song);
-int playlistInfo(FILE * fp, int song);
+int playlistInfo(int fd, int song);
-int playlistId(FILE * fp, int song);
+int playlistId(int fd, int song);
-int stopPlaylist(FILE * fp);
+int stopPlaylist(int fd);
-int playPlaylist(FILE * fp, int song, int stopOnError);
+int playPlaylist(int fd, int song, int stopOnError);
-int playPlaylistById(FILE * fp, int song, int stopOnError);
+int playPlaylistById(int fd, int song, int stopOnError);
-int nextSongInPlaylist(FILE * fp);
+int nextSongInPlaylist(int fd);
void syncPlayerAndPlaylist();
-int previousSongInPlaylist(FILE * fp);
+int previousSongInPlaylist(int fd);
-int shufflePlaylist(FILE * fp);
+int shufflePlaylist(int fd);
-int savePlaylist(FILE * fp, char *utf8file);
+int savePlaylist(int fd, char *utf8file);
-int deletePlaylist(FILE * fp, char *utf8file);
+int deletePlaylist(int fd, char *utf8file);
-int deletePlaylistById(FILE * fp, char *utf8file);
+int deletePlaylistById(int fd, char *utf8file);
void deleteASongFromPlaylist(Song * song);
-int moveSongInPlaylist(FILE * fp, int from, int to);
+int moveSongInPlaylist(int fd, int from, int to);
-int moveSongInPlaylistById(FILE * fp, int id, int to);
+int moveSongInPlaylistById(int fd, int id, int to);
-int swapSongsInPlaylist(FILE * fp, int song1, int song2);
+int swapSongsInPlaylist(int fd, int song1, int song2);
-int swapSongsInPlaylistById(FILE * fp, int id1, int id2);
+int swapSongsInPlaylistById(int fd, int id1, int id2);
-int loadPlaylist(FILE * fp, char *utf8file);
+int loadPlaylist(int fd, char *utf8file);
int getPlaylistRepeatStatus();
-int setPlaylistRepeatStatus(FILE * fp, int status);
+int setPlaylistRepeatStatus(int fd, int status);
int getPlaylistRandomStatus();
-int setPlaylistRandomStatus(FILE * fp, int status);
+int setPlaylistRandomStatus(int fd, int status);
int getPlaylistCurrentSong();
@@ -104,17 +104,17 @@ unsigned long getPlaylistVersion();
void playPlaylistIfPlayerStopped();
-int seekSongInPlaylist(FILE * fp, int song, float time);
+int seekSongInPlaylist(int fd, int song, float time);
-int seekSongInPlaylistById(FILE * fp, int id, float time);
+int seekSongInPlaylistById(int fd, int id, float time);
void playlistVersionChange();
-int playlistChanges(FILE * fp, mpd_uint32 version);
+int playlistChanges(int fd, mpd_uint32 version);
-int playlistChangesPosId(FILE * fp, mpd_uint32 version);
+int playlistChangesPosId(int fd, mpd_uint32 version);
-int PlaylistInfo(FILE * fp, char *utf8file, int detail);
+int PlaylistInfo(int fd, char *utf8file, int detail);
char *getStateFile();