aboutsummaryrefslogtreecommitdiffstats
path: root/src/song.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2008-10-12song: use mpd_sizeof_str_flex_array for song.urlEric Wong1-2/+2
This can potentially save a few bytes on 64-bit architectures and makes it more obvious what we're doing.
2008-10-11song: removed CamelCaseMax Kellermann1-6/+6
CamelCase is ugly... rename all functions.
2008-10-11song: replaced all song constructorsMax Kellermann1-2/+13
Provide separate constructors for creating a remote song, a local song, and one for loading data from a song file. This way, we can add more assertions.
2008-10-11CPP include cleanupMax Kellermann1-2/+0
Include only headers which are really used. [ew: this is totally different from Max's branch]
2008-10-11song: converted typedef Song to struct songMax Kellermann1-11/+11
Again, a data type which can be forward-declared. [ew: * used "struct mpd_song" instead to avoid token duplication (like I did with "struct mpd_tag") as there's no good abbreviation for "song" and identical tokens on the same line don't read well * rewritten using perl -i -p -e 's/\bSong\b/struct mpd_song/g' src/*.[ch] since it was too hard to merge * also, I don't care much for forward declarations ]
2008-10-11directory: converted typedef Directory to struct directoryMax Kellermann1-3/+3
The struct can be forward-declared by other headers, which relaxes the header dependencies.
2008-10-11song: really make the song struct non-packedMax Kellermann1-1/+1
Somehow I must have missed this in commit 22e40b61.
2008-10-11song: don't make the struct packedMax Kellermann1-1/+1
The "packed" attribute may have negative side effects on performance. Remove the "packed" attribute, and increase the size of "song.url" to a multiple of the machine word size.
2008-10-07directory: serialize song deletes from playlist during updateEric Wong1-2/+0
This makes the update code thread-safe and doesn't penalize the playlist code by complicating it with complicated and error-prone locks (and the associated overhead, not everybody has a thread-implementation as good as NPTL). The update task blocks during the delete; but the update task is a slow task anyways so we can block w/o people caring too much. This was also our only freeSong call site, so remove that function. Note that deleting entire directories is not fully thread-safe, yet; as their traversals are not yet locked.
2008-10-07song: Add song_print_url_xEric Wong1-0/+3
It'll be handy for passing throug songvec_for_each like song_print_info_x.
2008-10-06song: add print_song_info_x for iterators tha pass void *Eric Wong1-0/+3
traverseAllIn will be modified to take < 0 as errors instead of non-zero...
2008-10-05song: replace printSong* with song_print_*Eric Wong1-2/+2
This make argument order more consistent for iterators. Additionally, these now return ssize_t results for error checking.
2008-10-05song: stop storing song_typeEric Wong1-8/+6
We already know if a song is a URL or not based on whether it has parentDir defined or not. Hopefully one day in the future we can drop HTTP support from MPD entirely when an HTTP filesystem comes along and we can access streams via open(2).
2008-10-05song: use flex arrays to store song->urlEric Wong1-3/+4
Reduce the number of allocations we make, so there's less pressure on the allocator and less overhead to keep track of the allocations in.
2008-10-05song: converted "type" to enumMax Kellermann1-4/+7
Having an enum type is much nicer than an anonymous integer plus CPP macros. Note that the old code didn't save any space by declaring the variable 8 bit, due to padding.
2008-09-29Switch to C99 types (retaining compat with old compilers)Eric Wong1-1/+1
Seeing the "mpd_" prefix _everywhere_ is mind-numbing as the mind needs to retrain itself to skip over the first 4 tokens of a type to get to its meaning. So avoid having extra characters on my terminal to make it easier to follow code at 2:30 am in the morning. Please report any new issues you may come across on Free toolchains. I realize how difficult it can be to build/maintain cross-compiling toolchains and I have no intention of forcing people to upgrade their toolchains to build mpd. Tested with gcc 2.95.4 and and gcc 4.3.1 on x86-32.
2008-09-26song: removed type SongListMax Kellermann1-9/+0
SongList has been superseded by struct songvec.
2008-09-20Replace SongList with struct songvecEric Wong1-6/+3
Our linked-list implementation is wasteful and the SongList isn't modified enough to benefit from being a linked list. So use a more compact array of song pointers which saves ~200K on a library with ~9K songs (on x86-32).
2008-09-18Move away from fprintf() when writing DB/state_fileEric Wong1-1/+1
I have serious trust issues when using stdio to write to the FS. So it's best to clean this code out so I can start figuring out what's wrong with Rasi's box not updating... None of these writes take place in a performance-critical setting anyways...
2008-09-02song: don't export newNullSong()Max Kellermann1-2/+0
The function newNullSong() is only used internally in song.c.
2008-09-02tag: renamed MpdTag and MpdTagItem to struct mpd_tag, struct tag_itemMax Kellermann1-1/+1
Getting rid of CamelCase; not having typedefs also allows us to forward-declare the structures.
2008-04-12song: document get_song_url()Eric Wong1-0/+6
[merged r7184 from branches/ew] git-svn-id: https://svn.musicpd.org/mpd/trunk@7242 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-02-05fix -Wconst warningsMax Kellermann1-2/+2
[ew: cleaned up the dirty union hack a bit] Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7180 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-03Cleanup #includes of standard system headers and put them in one placeEric Wong1-4/+1
This will make refactoring features easier, especially now that pthreads support and larger refactorings are on the horizon. Hopefully, this will make porting to other platforms (even non-UNIX-like ones for masochists) easier, too. os_compat.h will house all the #includes for system headers considered to be the "core" of MPD. Headers for optional features will be left to individual source files. git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-12-28Merge branches/ew r7104Eric Wong1-1/+1
thread-safety work in preparation for rewrite to use pthreads Expect no regressions against trunk (r7078), possibly minor performance improvements in update (due to fewer heap allocations), but increased stack usage. Applied the following patches: * maxpath_str for reentrancy (temporary fix, reverted) * path: start working on thread-safe variants of these methods * Re-entrancy work on path/character-set conversions * directory.c: exploreDirectory() use reentrant functions here * directory/update: more use of reentrant functions + cleanups * string_toupper: a strdup-less version of strDupToUpper * get_song_url: a static-variable-free version of getSongUrl() * Use reentrant/thread-safe get_song_url everywhere * replace rmp2amp with the reentrant version, rmp2amp_r * Get rid of the non-reentrant/non-thread-safe rpp2app, too. * buffer2array: assert strdup() returns a usable value in unit tests * replace utf8ToFsCharset and fsCharsetToUtf8 with thread-safe variants * fix storing playlists w/o absolute paths * parent_path(), a reentrant version of parentPath() * parentPath => parent_path for reentrancy and thread-safety * allow "make test" to automatically run embedded unit tests * remove convStrDup() and maxpath_str() * use MPD_PATH_MAX everywhere instead of MAXPATHLEN * path: get rid of appendSlash, pfx_path and just use pfx_dir * get_song_url: fix the ability to play songs in the top-level music_directory git-svn-id: https://svn.musicpd.org/mpd/trunk@7106 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-05The massive copyright updateAvuton Olrich1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-10-27add support for: list fileWarren Dukes1-0/+3
This behaves the same as: list filename git-svn-id: https://svn.musicpd.org/mpd/trunk@4952 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-20Fix warnings for -Wmissing-prototypesAvuton Olrich1-2/+2
Add -Wmissing-prototypes if compiling with gcc Static where possible git-svn-id: https://svn.musicpd.org/mpd/trunk@4657 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30interface/connection malloc reductions from mpd-keEric Wong1-3/+3
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
2006-07-20Add mpd-indent.shAvuton Olrich1-11/+11
Indent the entire tree, hopefully we can keep it indented. git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-15[CLEANUP] Remove unused codeAvuton Olrich1-2/+0
Cleanup whitespace->tabs git-svn-id: https://svn.musicpd.org/mpd/trunk@4347 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14Change shank's email addressJ. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13Huge header update, update the copyright and addAvuton Olrich1-1/+1
the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-11implement saved memory by not storing full pathWarren Dukes1-3/+6
git-svn-id: https://svn.musicpd.org/mpd/trunk@2601 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-11this is brokenWarren Dukes1-11/+12
git-svn-id: https://svn.musicpd.org/mpd/trunk@2597 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-03remove vim &*(@Warren Dukes1-1/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@2500 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-31icynames are now copied to title of streamsWarren Dukes1-0/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@1258 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-19fix a nasty bug when deleting a stream from the playlistWarren Dukes1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@1082 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-13redimentary addition of url's to playlistWarren Dukes1-0/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@1000 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-13add type element to Song struct, and change utf8file to utf8urlWarren Dukes1-3/+10
git-svn-id: https://svn.musicpd.org/mpd/trunk@999 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-14add vim shiznit to end of all source filesWarren Dukes1-0/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@750 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-03-18bunch of autotool cleanupsWarren Dukes1-0/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@271 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-03-11move time back into MpdTagWarren Dukes1-1/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@250 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-03-10move time from tag info to song info.Warren Dukes1-0/+1
also, if we can't get the time, then don't add the song to the db! git-svn-id: https://svn.musicpd.org/mpd/trunk@236 09075e82-0dd4-0310-85a5-a0d7c8717e4f