aboutsummaryrefslogtreecommitdiffstats
path: root/src/song.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong2006-08-261-5/+6
| | | | | | | | | | | | | | | | | | | I'm checking for zero-size allocations and assert()-ing them, so we can more easily get backtraces and debug problems, but we'll also allow -DNDEBUG people to live on the edge if they wish. We do not rely on errno when checking for OOM errors because some implementations of malloc do not set it, and malloc is commonly overridden by userspace wrappers. I've spent some time looking through the source and didn't find any obvious places where we would explicitly allocate 0 bytes, so we shouldn't trip any of those assertions. We also avoid allocating zero bytes because C libraries don't handle this consistently (some return NULL, some not); and it's dangerous either way. git-svn-id: https://svn.musicpd.org/mpd/trunk@4690 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* remove deprecated myfprintf wrapperEric Wong2006-07-301-4/+5
| | | | | | | This shaves another 5-6k because we've removed the paranoid fflush() calls after every fprintf. Now we only fflush() when we need to git-svn-id: https://svn.musicpd.org/mpd/trunk@4493 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* interface/connection malloc reductions from mpd-keEric Wong2006-07-301-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add mpd-indent.shAvuton Olrich2006-07-201-121/+140
| | | | | | 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
* sparse: ANSI-fy function declarationsEric Wong2006-07-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are just warnings from sparse, but it makes the output easier to read. I ran this through a quick perl script, but of course verified the output by looking at the diff and making sure the thing still compiles. here's the quick perl script I wrote to generate this patch: ----------- 8< ----------- use Tie::File; defined(my $pid = open my $fh, '-|') or die $!; if (!$pid) { open STDERR, '>&STDOUT' or die $!; exec 'sparse', @ARGV or die $!; } my $na = 'warning: non-ANSI function declaration of function'; while (<$fh>) { print STDERR $_; if (/^(.+?\.[ch]):(\d+):(\d+): $na '(\w+)'/o) { my ($f, $l, $pos, $func) = ($1, $2, $3, $4); $l--; tie my @x, 'Tie::File', $f or die "$!: $f"; print '-', $x[$l], "\n"; $x[$l] =~ s/\b($func\s*)\(\s*\)/$1(void)/; print '+', $x[$l], "\n"; untie @x; } } git-svn-id: https://svn.musicpd.org/mpd/trunk@4378 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* [CLEANUP] Remove unused codeAvuton Olrich2006-07-151-19/+7
| | | | | Cleanup whitespace->tabs git-svn-id: https://svn.musicpd.org/mpd/trunk@4347 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Change shank's email addressJ. Alexander Treuman2006-07-141-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Huge header update, update the copyright and addAvuton Olrich2006-07-131-1/+1
| | | | | the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix for bug 483Qball Cow2006-05-081-1/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4138 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* merge with mpd/trunk up to r3925Eric Wong2006-03-161-7/+13
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3926 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* debug messages no longer cause segfaults :PEric Wong2005-10-251-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3553 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Patch to make the configure flag for mpd-mad and mpd-libid3tag more logic ↵Qball Cow2005-09-081-1/+6
| | | | | (from ticho) git-svn-id: https://svn.musicpd.org/mpd/trunk@3477 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* this shit really needs to be cleaned up, but its good enough for testing,Warren Dukes2004-11-151-1/+1
| | | | | intelligently use memmove, when inserting nodes in a sorted list git-svn-id: https://svn.musicpd.org/mpd/trunk@2677 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix a bug in pringSongUrl, don't print leading '/' for songs in root dirWarren Dukes2004-11-121-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2631 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* don't store only relative paths in the directory structure, its probably notWarren Dukes2004-11-121-1/+1
| | | | | worth the savings in memory for the extra cpu it requires git-svn-id: https://svn.musicpd.org/mpd/trunk@2630 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* ok, optimize memory sage of directorys, by iteratively creating the directories,Warren Dukes2004-11-111-7/+15
| | | | | | | | this code needs some serious testing: Note: The song name optimization i think is worth it, saves about 200k of ram on my syste, however, having to create directory names iteratively each time we print probably isn't worth the cpu. We only save about 10k of ram for the computer todo alot more work, and the code maybe a little messier git-svn-id: https://svn.musicpd.org/mpd/trunk@2604 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* ok, now song->url is only the filename, not the full path to the songWarren Dukes2004-11-111-4/+5
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2602 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* implement saved memory by not storing full pathWarren Dukes2004-11-111-31/+61
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2601 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* this is brokenWarren Dukes2004-11-111-7/+21
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2597 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* merge changes from metadata-rewrite branchWarren Dukes2004-11-101-36/+20
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2589 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* todo updateWarren Dukes2004-11-031-1/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2499 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* todo updateWarren Dukes2004-06-061-0/+5
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1352 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* '\n' are badWarren Dukes2004-06-021-1/+5
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1296 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* little cleanup of plugin stuffWarren Dukes2004-05-311-2/+6
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1247 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* mp3 and ogg plugin stuffWarren Dukes2004-05-311-64/+10
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1245 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* add type element to Song struct, and change utf8file to utf8urlWarren Dukes2004-05-131-62/+79
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@999 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* add vim shiznit to end of all source filesWarren Dukes2004-04-141-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@750 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* ok, rework myfprintf so it uses write() and never use any file streamWarren Dukes2004-04-131-2/+0
| | | | | | | print functions. this way we can always know wtf is going on! also, remove some places where we were using fprintf and printf instead of myfprintf git-svn-id: https://svn.musicpd.org/mpd/trunk@734 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* block signals when writing db to ensure db isn't corruptedWarren Dukes2004-04-131-0/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@730 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* add --only-create-db option from msellsWarren Dukes2004-04-111-1/+1
| | | | | have SIGHUP cause rereading db file git-svn-id: https://svn.musicpd.org/mpd/trunk@663 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* work in prep of using msells/sbh's non-blocking update methodWarren Dukes2004-04-101-4/+55
| | | | | | | Here, i've made readDirectoryDB detect when stuff is deleted, added and updated. So after a update, and we call redDirectoryDB, we update the db instead of just adding stuff w/o "updating" and "deleting" stuff as neccessary. git-svn-id: https://svn.musicpd.org/mpd/trunk@659 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* use EXIT_SUCCESS and EXIT_FAILUREWarren Dukes2004-04-021-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@591 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* lets cleanup some file type detection and not call stat() so muchWarren Dukes2004-03-311-14/+14
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@575 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* parse length from Aac files and ID3 tagsWarren Dukes2004-03-211-0/+6
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@346 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* bunch of autotool cleanupsWarren Dukes2004-03-181-6/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@271 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* have AAC and MP4 typesWarren Dukes2004-03-171-0/+6
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@267 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix a few snafoo's in configure.acWarren Dukes2004-03-171-0/+10
| | | | | Add initial stuff for AAC support, now we just need to write the decoder git-svn-id: https://svn.musicpd.org/mpd/trunk@264 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* move time back into MpdTagWarren Dukes2004-03-111-31/+12
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@250 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* move adding and removeing from tables from directory.c to song.cWarren Dukes2004-03-101-20/+48
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@239 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix it so that mpd will work if mtime is 0 (for those strange folk)Warren Dukes2004-03-101-9/+9
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@237 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* move time from tag info to song info.Warren Dukes2004-03-101-18/+36
| | | | | 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
* lets exit on unknown line in songinfo dbWarren Dukes2004-03-091-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@230 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* strip return characters that are in the id3 tagsWarren Dukes2004-03-091-2/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@229 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* import from SF CVSWarren Dukes2004-02-231-0/+231
git-svn-id: https://svn.musicpd.org/mpd/trunk@1 09075e82-0dd4-0310-85a5-a0d7c8717e4f