aboutsummaryrefslogtreecommitdiffstats
path: root/src/interface.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2007-01-14Don't initialize globals to zero (or NULL)Eric Wong1-6/+6
Some compilers and linkers aren't smart enough to optimize this, as global variables are implictly initialized to zero. As a result, binaries are a bit smaller as more goes in the .bss and less in the text section. git-svn-id: https://svn.musicpd.org/mpd/trunk@5254 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-14avahi: more sparse fixes (-Wshadow, non-ANSI declarations)Eric Wong1-8/+8
git-svn-id: https://svn.musicpd.org/mpd/trunk@5248 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-11Added zeroconf service publishing using avahiJim Ramsay1-2/+60
git-svn-id: https://svn.musicpd.org/mpd/trunk@5238 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-26Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong1-3/+3
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
2006-08-18fix a few warnings on 64-bit machinesEric Wong1-2/+2
size_t is bigger than int on most 64-bit machines, so cast size_t to long when passing them to printf-like functions. Ideally we'd use %z, but many compilers don't support it. git-svn-id: https://svn.musicpd.org/mpd/trunk@4656 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-10Separate PROTOCOL_VERSION from VERSIONEric Wong1-1/+1
So we can have VERSION=0.12.0rc1 and keep the clients seeing 0.12.0 git-svn-id: https://svn.musicpd.org/mpd/trunk@4608 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01Several fixes uncovered with -pedanticEric Wong1-5/+5
playerData.c: proper error checking directory.c: properly check myFgets() for errors (it returns NULL on error) inputPlugins/mp3_plugin.c get rid of commas at the end of enums interface.c: we weren't using long long, so strtoll isn't needed get rid of void-pointer arithmetic sllist.c: get rid of void-pointer arithmetic compress.c: get rid of C++ comments, some compilers don't accept them Note that I personally like void pointer arithmetic, but some ancient compilers don't support them :( git-svn-id: https://svn.musicpd.org/mpd/trunk@4510 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30fix some warnings introduced in the big malloc-reduction patchEric Wong1-0/+1
The myfprintf bugs that are fixed here were NOT introduced in the last patch, it's just that the stricter warning checks from moving to fprintf caused string format bugs to actually be checked by gcc git-svn-id: https://svn.musicpd.org/mpd/trunk@4484 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30interface/connection malloc reductions from mpd-keEric Wong1-175/+270
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-6/+6
Add a few new options for indent to try to make things a bit cleaner git-svn-id: https://svn.musicpd.org/mpd/trunk@4411 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-20Add mpd-indent.shAvuton Olrich1-294/+300
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-17some quick hacks to avoid signedness warnings with gcc4Warren Dukes1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@4387 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-17sparse: ANSI-fy function declarationsEric Wong1-6/+6
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
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-14[CLEANUP] Remove unused codeAvuton Olrich1-32/+12
Static what makes sense git-svn-id: https://svn.musicpd.org/mpd/trunk@4327 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14[CLEANUP] Remove unnecessary includes, staticAvuton Olrich1-3/+3
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
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
2006-05-10My first commit! :D Make sure the same interface isn't closed twice when ↵J. Alexander Treuman1-1/+2
max_command_list_size is exceeded, and don't abort mpd should the same interface be closed twice somewhere else. git-svn-id: https://svn.musicpd.org/mpd/trunk@4151 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-08-18change a break; to a return statementWarren Dukes1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@3444 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-08-18attempt to fix an issue discoverred by jat with sending two close commands ↵Warren Dukes1-0/+5
back to back will cause an assert to fail git-svn-id: https://svn.musicpd.org/mpd/trunk@3442 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-04-27change the default max_output_buffer_size from 2048 to 8192Warren Dukes1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@3226 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-19cleanup some debug codeWarren Dukes1-14/+11
git-svn-id: https://svn.musicpd.org/mpd/trunk@3102 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-19fix some signal handlingWarren Dukes1-0/+11
git-svn-id: https://svn.musicpd.org/mpd/trunk@3101 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-12*) slight code cleanupWarren Dukes1-10/+15
*) now --kill will not check for /proc/<pid>/exe (this is linux specific) git-svn-id: https://svn.musicpd.org/mpd/trunk@3063 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-02-07make the "kill" command work againEric Wong1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@2936 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-12-22fix some casting issues in error messages for output buffer sizeWarren Dukes1-5/+6
git-svn-id: https://svn.musicpd.org/mpd/trunk@2812 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-16fix an issue with errors and new read() code on interfaceWarren Dukes1-3/+8
git-svn-id: https://svn.musicpd.org/mpd/trunk@2683 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-14no longer need to include sig_handlers.h in interfac.ecWarren Dukes1-1/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@2651 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-14fix a few bugs in read()'ingWarren Dukes1-8/+9
git-svn-id: https://svn.musicpd.org/mpd/trunk@2650 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-14optimized read() on clients, should be much, much faster nowWarren Dukes1-121/+120
git-svn-id: https://svn.musicpd.org/mpd/trunk@2649 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-11ok, now song->url is only the filename, not the full path to the songWarren Dukes1-4/+6
git-svn-id: https://svn.musicpd.org/mpd/trunk@2602 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-03now one can specify multiple bind_to_addressesWarren Dukes1-3/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@2501 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-31we need to initialize interface_max_connections to 0, to indicate we have ↵Warren Dukes1-1/+3
no open/possible interfaces for interfacePrintWithFD() (i.e. so we don't get a segfault when creating the db, or other potential problems) git-svn-id: https://svn.musicpd.org/mpd/trunk@2434 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-28merge shank-rewrite-config changesWarren Dukes1-25/+56
git-svn-id: https://svn.musicpd.org/mpd/trunk@2375 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-07-12potential fixes for NHI\'s bugsWarren Dukes1-1/+3
git-svn-id: https://svn.musicpd.org/mpd/trunk@1848 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-15fix C99 stuff for commandErrorWarren Dukes1-8/+9
also some slight optimizations to interfacePrintWithFD() and myfprintf() git-svn-id: https://svn.musicpd.org/mpd/trunk@1503 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-05implement list_OK/command_list_ok_beginWarren Dukes1-15/+17
update COMMANDS git-svn-id: https://svn.musicpd.org/mpd/trunk@1344 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-04finish ack error codesWarren Dukes1-0/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@1325 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-04clean up ACK error coding a little bitWarren Dukes1-8/+6
git-svn-id: https://svn.musicpd.org/mpd/trunk@1321 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-11fix foobar!Warren Dukes1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@993 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-11maybe this fixes remoford's bug?!?Warren Dukes1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@992 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-04-13ok, rework myfprintf so it uses write() and never use any file streamWarren Dukes1-6/+3
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
2004-04-12cleanup interface between interface.[ch] and command.[ch]Warren Dukes1-41/+43
primarily move all buffer2array stuff from interface.c to command.c and write a new command function explicitly for dealing with commandLists git-svn-id: https://svn.musicpd.org/mpd/trunk@701 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-11incremental updates and command-list/update kung fuWarren Dukes1-5/+10
this needs some serious cleaning up and testing git-svn-id: https://svn.musicpd.org/mpd/trunk@692 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-02use EXIT_SUCCESS and EXIT_FAILUREWarren Dukes1-4/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@591 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-01use our own portable version of usleep using select()Warren Dukes1-2/+3
git-svn-id: https://svn.musicpd.org/mpd/trunk@578 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-03-31cleanup reading from interface, when argArrayLength returned by buffer2arrayWarren Dukes1-3/+11
is 0, we weren't dealing with this well at all! git-svn-id: https://svn.musicpd.org/mpd/trunk@559 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-02-25cleanup logging, need to be careful with SECURE and DEBUGWarren Dukes1-4/+18
git-svn-id: https://svn.musicpd.org/mpd/trunk@58 09075e82-0dd4-0310-85a5-a0d7c8717e4f