aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* command: fix find/search commands from the malloc reduction patchEric Wong2006-07-301-4/+7
| | | | | | | | | The most we ever use is for search/find, and that limits it to the number of tags we can have. Add one for the command, and one extra to catch errors clients may send us. Thanks to Qball for reporting this bug git-svn-id: https://svn.musicpd.org/mpd/trunk@4486 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* interface/connection malloc reductions from mpd-keEric Wong2006-07-301-263/+255
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* replace buffer2array() with cstrtok() from mpd-keEric Wong2006-07-291-15/+14
| | | | | | | | This modifies the string in place, and does not allocate any memory from the heap. This is considerably smaller than the function it replaces, and will be instrumental in getting the commands/conf malloc reductions done. git-svn-id: https://svn.musicpd.org/mpd/trunk@4481 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* command.c: shorten common variable names to argc and argvEric Wong2006-07-291-209/+209
| | | | | | Any C programmer with half a clue knows they mean argArrayLength and argArray, and I find the code much easier to read and work with. git-svn-id: https://svn.musicpd.org/mpd/trunk@4480 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add mpd-indent.shAvuton Olrich2006-07-201-714/+774
| | | | | | 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
* some quick hacks to avoid signedness warnings with gcc4Warren Dukes2006-07-171-68/+76
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4387 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* sparse: ANSI-fy function declarationsEric Wong2006-07-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* command.c: fix a format-string error (go sparse!)Eric Wong2006-07-151-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4356 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
* [CLEANUP] Remove unnecessary includes, staticAvuton Olrich2006-07-141-68/+67
| | | | | | functions that don't need to be exported, rename misspelled function git-svn-id: https://svn.musicpd.org/mpd/trunk@4325 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
* outputs now only needs read permissionQball Cow2006-04-271-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4127 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Adding of plchangesposid command, this is a stripped down version of the ↵Qball Cow2006-04-231-0/+17
| | | | | plchanges command, it only sends the pos and id of the changed command. Libmpd allready has support for it, and libmpdclient in libmpd too git-svn-id: https://svn.musicpd.org/mpd/trunk@4101 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* src/command.c: protocol commands are all lowercase, _always_Eric Wong2006-03-261-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3950 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Support for fetching the content of a stored playlist (patch by qball), this ↵Qball Cow2006-03-261-0/+14
| | | | | adds listPlaylist and listPlaylistInfo git-svn-id: https://svn.musicpd.org/mpd/trunk@3947 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* command.c: remove unnecessary strdup()Eric Wong2006-03-161-5/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3924 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix addid crash ( found by qball )Warren Dukes2006-01-071-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3805 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix AddId handler, It tried to add the first argument instead of the 2nd. ↵Qball Cow2005-08-071-1/+1
| | | | | Resulting it tries to add "addid" git-svn-id: https://svn.musicpd.org/mpd/trunk@3427 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix spelling errorWarren Dukes2005-05-071-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3245 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* 'add' command now requires one argumentWarren Dukes2005-05-031-6/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3236 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* undo change 3081Warren Dukes2005-03-151-18/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3085 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* - Add 'mute' command for testingAvuton Olrich2005-03-141-0/+18
| | | | | - Revamp AUTHORS file git-svn-id: https://svn.musicpd.org/mpd/trunk@3081 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix logic for commands and notcommands for real this timeWarren Dukes2004-11-231-3/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2740 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix a little logic bomb in commands && notcommandsWarren Dukes2004-11-231-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2739 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* added "notcommands" commandWarren Dukes2004-11-231-0/+21
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2738 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* optimized read() on clients, should be much, much faster nowWarren Dukes2004-11-141-3/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2649 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* correct a type in the error messageWarren Dukes2004-11-121-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2625 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* now more flexible list, search, find, where you can enter pairs ofWarren Dukes2004-11-121-16/+28
| | | | | "conditionals". Note that logical and is implied. git-svn-id: https://svn.musicpd.org/mpd/trunk@2624 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* ok, now song->url is only the filename, not the full path to the songWarren Dukes2004-11-111-3/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2602 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* merge changes from metadata-rewrite branchWarren Dukes2004-11-101-6/+59
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2589 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* new command "commands" for avutonWarren Dukes2004-11-081-0/+22
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2547 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* new command "addid", this is the same as "add" command, except it also ↵Warren Dukes2004-11-021-1/+9
| | | | | returns the songid of the added song. Note that "addid" does not work on directories git-svn-id: https://svn.musicpd.org/mpd/trunk@2487 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* new command "devices", prints devices and their statesWarren Dukes2004-11-021-2/+12
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2486 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* new commands: enalbe_device, and disable_device, (maybe these commands ↵Warren Dukes2004-11-021-0/+36
| | | | | | | should be toggles instead of two seperate commands?) also, on close device, close the shout connection git-svn-id: https://svn.musicpd.org/mpd/trunk@2485 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix playlistid command so it can take an argumentWarren Dukes2004-06-191-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1575 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix C99 stuff for commandErrorWarren Dukes2004-06-151-12/+13
| | | | | also some slight optimizations to interfacePrintWithFD() and myfprintf() git-svn-id: https://svn.musicpd.org/mpd/trunk@1503 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* make swapid and deleteid actually workWarren Dukes2004-06-131-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1461 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* make seekid actually workWarren Dukes2004-06-131-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1460 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* make playid actually workWarren Dukes2004-06-131-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1459 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* change 'current' command to 'currentsong'Warren Dukes2004-06-121-3/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1447 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* todo updateWarren Dukes2004-06-101-0/+13
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1433 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* implemented songid commands: playlistid, playid, seekid, deleteid, moveid, ↵Warren Dukes2004-06-091-1/+133
| | | | | swapid git-svn-id: https://svn.musicpd.org/mpd/trunk@1408 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* potential bugfixes for handling metadata in player/decoderWarren Dukes2004-06-071-1/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1369 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* implement list_OK/command_list_ok_beginWarren Dukes2004-06-051-1/+2
| | | | | update COMMANDS git-svn-id: https://svn.musicpd.org/mpd/trunk@1344 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* new command, plchanges, and also add Num: to songinfo of playlistinfoWarren Dukes2004-06-051-32/+48
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1339 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* finish ack error codesWarren Dukes2004-06-041-21/+38
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1325 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* work on ACK error codesWarren Dukes2004-06-041-1/+15
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1324 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* clean up ACK error coding a little bitWarren Dukes2004-06-041-36/+23
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1321 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* don't stop on play command!Warren Dukes2004-06-031-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1313 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* add urlhandlers command, but prolly not neededWarren Dukes2004-06-021-0/+8
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1307 09075e82-0dd4-0310-85a5-a0d7c8717e4f