Commit Graph

38 Commits

Author SHA1 Message Date
Max Kellermann b7d2d4cfe8 database: don't allow uri==NULL
Add nonnull attributes and fix all callers.
2011-09-13 21:39:07 +02:00
Max Kellermann 169db88c20 database: add struct db_visitor
Use this struct for db_walk().
2011-09-13 19:37:28 +02:00
Max Kellermann c6cbcc2c25 copyright year 2011 2011-01-29 10:13:54 +01:00
Max Kellermann b6995ca011 player_control: removed the global variable "pc"
Allocate a player_control object where needed, and pass it around.
Each "client" object is associated with a "player_control" instance.

This prepares multi-player support.
2011-01-10 19:46:23 +01:00
Avuton Olrich 9d3865cb95 Update copyright notices. 2009-12-31 20:58:43 -08:00
Max Kellermann 5b82ffc291 include config.h in all sources
After we've been hit by Large File Support problems several times in
the past week (which only occur on 32 bit platforms, which I don't
have), this is yet another attempt to fix the issue.
2009-11-12 09:17:03 +01:00
Max Kellermann ea616b3ed4 tag: removed the "_ITEM_" suffix from the enum names 2009-10-13 16:12:45 +02:00
Max Kellermann e5857cb722 player_control: no CamelCase 2009-10-08 21:12:57 +02:00
Avuton Olrich 0aee49bdf8 all: Update copyright header.
This updates the copyright header to all be the same, which is
pretty much an update of where to mail request for a copy of the GPL
and the years of the MPD project. This also puts all committers under
'The Music Player Project' umbrella. These entries should go
individually in the AUTHORS file, for consistancy.
2009-03-13 11:51:55 -07:00
Max Kellermann 75c2029b1c tag: no CamelCase
Renamed numOfItems to num_items.
2009-02-27 09:01:55 +01:00
Max Kellermann 004dfddca3 stats: use GTimer instead of time(NULL)
time(NULL) shows the wrong results when the machine's clock is
changed.
2009-01-18 15:40:53 +01:00
Max Kellermann 14ca99b224 stats: use one db_walk() to obtain stats
Don't use dbUtils.h functions.  This reduces 4 full database walks to
just one.
2009-01-18 15:40:50 +01:00
Max Kellermann 91fb2a29de stats: added num_artists, num_albums
Don't recalculate the number of artists and albums each time a client
requests statistics.  Calculate that once in stats_update().
2009-01-18 15:40:28 +01:00
Max Kellermann 0d449d8df7 stats: no CamelCase
Renamed functions and types.
2009-01-18 15:22:26 +01:00
Max Kellermann 6acba73509 stats: added stats_update() 2009-01-04 20:57:06 +01:00
Max Kellermann 95b3430f52 removed os_compat.h
Only include headers which are really needed.  os_compat.h aimed to
make MPD easily portable, but was never actually made portable.
2008-12-29 17:28:32 +01:00
Max Kellermann bb8a9533b1 database: renamed functions, "db_" prefix and no CamelCase
Yet another CamelCase removal patch.
2008-10-08 11:07:55 +02:00
Max Kellermann 8a50e8a266 directory: moved code to database.c
Taming the directory.c monster, part II: move the database management
stuff to database.  directory.c should only contain code which works
on directory objects.
2008-10-08 11:07:35 +02:00
Max Kellermann d562ba5fbb song: converted typedef Song to struct song
Again, a data type which can be forward-declared.
2008-10-08 10:49:11 +02:00
Max Kellermann f0e64ceb48 use strset.h instead of tagTracker.h
With a large music database, the linear string collection in
tagTracker.c becomes very slow.  We implemented that in a
quick'n'dirty fashion when we removed tree.c, and now we rewrite it
using the fast hashed string set.
2008-09-08 11:47:57 +02:00
Max Kellermann a6c5928c75 stats: don't pass "fd" to printStats()
Pass the client struct instead of the raw file descriptor.
2008-09-07 14:02:57 +02:00
Max Kellermann a34e1d2b84 include cleanup
As usual, include only headers which are really needed.
2008-09-06 20:28:31 +02:00
Max Kellermann 5e51fa020d renamed player.c to player_control.c
Give player.c a better name, meaning that the code is used to control
the player thread.
2008-08-26 08:44:38 +02:00
Max Kellermann c89b358c8a clean up CPP includes
Try to only include headers which are really needed.  We should
particularly check all "headers including other headers".  The
long-term goal is to have a manageable, small API for plugins
(decoders, output) without so many mpd internals cluttering the
namespace.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:19:26 +00:00
Eric Wong cb8f1af3bd Cleanup #includes of standard system headers and put them in one place
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
2008-01-03 07:29:49 +00:00
Avuton Olrich a061da8fb5 The massive copyright update
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-05 03:22:33 +00:00
Eric Wong e86fd65c81 commandError() cleanups, fixup gcc checks
stripped binary size reduced by 9k on my machine from making
commandError a function.  We'll print out error messages slightly
slower before, but the smaller binary is more than worth it.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4488 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 08:47:50 +00:00
Eric Wong 4cf5d04ca1 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
2006-07-30 03:43:38 +00:00
Avuton Olrich 29a25b9933 Add mpd-indent.sh
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-20 16:02:40 +00:00
Eric Wong a234780aab sparse: ANSI-fy function declarations
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-17 00:15:34 +00:00
Avuton Olrich 3ad41fdda6 [CLEANUP] Remove unused code
Cleanup whitespace->tabs

git-svn-id: https://svn.musicpd.org/mpd/trunk@4347 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-15 05:04:16 +00:00
J. Alexander Treuman 2fa7125cce Change shank's email address
git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14 19:37:45 +00:00
Avuton Olrich a37348a74f Huge header update, update the copyright and add
the GPL header where necessary

git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13 19:20:34 +00:00
Warren Dukes c5d27d8eaa merge changes from metadata-rewrite branch
git-svn-id: https://svn.musicpd.org/mpd/trunk@2589 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-10 21:58:27 +00:00
Warren Dukes b4adc880a1 clean up some command.h include stuff
git-svn-id: https://svn.musicpd.org/mpd/trunk@1322 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-04 00:51:31 +00:00
Warren Dukes 549344d38a add vim shiznit to end of all source files
git-svn-id: https://svn.musicpd.org/mpd/trunk@750 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-14 14:53:41 +00:00
Warren Dukes 79effd62e1 display db_playtime in stats
git-svn-id: https://svn.musicpd.org/mpd/trunk@98 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-02-27 15:39:19 +00:00
Warren Dukes d35747a40c import from SF CVS
git-svn-id: https://svn.musicpd.org/mpd/trunk@1 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-02-23 23:41:20 +00:00