aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbUtils.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* playlist: renamed global "playlist" variable to "g_playlist"Max Kellermann2009-02-041-1/+1
| | | | | | | Export the "g_playlist" variable, and pass it to all playlist functions. This way, we can split playlist.c easier into separate parts. The code which initializes the singleton variable is moved to playlist_global.c.
* use g_free() instead of free()Max Kellermann2009-01-251-1/+1
| | | | | | On some platforms, g_free() must be used for memory allocated by GLib. This patch intends to correct a lot of occurrences, but is probably not complete.
* locate: added locate_item_list_casefold()Max Kellermann2009-01-241-6/+2
| | | | | Merged casefolding code from two locations into this one library function.
* queue_print, dbUtils: use struct locate_item_listMax Kellermann2009-01-241-39/+21
| | | | | Changed the function prototypes to get locate_item_list objects instead of num_items/items.
* locate: added struct locate_item_listMax Kellermann2009-01-241-5/+6
| | | | | Instead of passing two parameters around (number of items, array of items), combine both in a variable size struct.
* locate: no CamelCaseMax Kellermann2009-01-241-7/+7
| | | | Renamed functions and variables.
* locate: renamed LocateTagItem to "struct locate_item"Max Kellermann2009-01-241-14/+18
| | | | No CamelCase and no typedefs.
* locate: use const pointersMax Kellermann2009-01-221-20/+13
| | | | Pass const pointers where no writes are performed.
* stats: use one db_walk() to obtain statsMax Kellermann2009-01-181-41/+0
| | | | | Don't use dbUtils.h functions. This reduces 4 full database walks to just one.
* directory: added directory_is_root()Max Kellermann2009-01-041-3/+4
| | | | | directory_is_root() is cheaper than isRootDirectory(directory_get_path()).
* dbUtils: use GLib instead of utils.hMax Kellermann2009-01-031-3/+4
|
* dbUtils.c: replaced mpd_unused by G_GNUC_UNUSEDThomas Jansen2008-11-241-2/+2
|
* stored_playlist: no CamelCaseMax Kellermann2008-10-221-1/+1
| | | | Renamed all public functions, prefix is "spl_".
* renamed storedPlaylist.c to stored_playlist.cMax Kellermann2008-10-221-1/+1
| | | | No CamelCase in file names.
* locate: use g_utf8_casefold() instead of string_toupper()Max Kellermann2008-10-151-2/+4
| | | | | | string_toupper() and strDupToUpper() were not able to deal with character sets other than US-ASCII. Use GLib's g_utf8_casefold() for strings.
* directory: fix update in root directoryMax Kellermann2008-10-081-2/+2
| | | | | | | Commit 0bfe7802 broke update for new files in the root directory, because music_root->path was an empty string and not NULL. There were some NULL tests missing. Change them to !isRootDirectory(path) instead of path!=NULL.
* directory: eliminate CamelCaseMax Kellermann2008-10-081-2/+2
| | | | CamelCase is ugly, rename the functions.
* database: renamed functions, "db_" prefix and no CamelCaseMax Kellermann2008-10-081-15/+13
| | | | Yet another CamelCase removal patch.
* directory: moved code to database.cMax Kellermann2008-10-081-0/+1
| | | | | | 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.
* song: converted typedef Song to struct songMax Kellermann2008-10-081-12/+23
| | | | Again, a data type which can be forward-declared.
* directory: converted typedef Directory to struct directoryMax Kellermann2008-10-081-6/+8
| | | | | The struct can be forward-declared by other headers, which relaxes the header dependencies.
* dbUtils/directory: traverseAllIn forEachSong returns -1 on errorEric Wong2008-10-071-2/+2
| | | | Being consistent with most UNIX functions...
* song: replace printSong* with song_print_*Eric Wong2008-10-071-6/+6
| | | | | | This make argument order more consistent for iterators. Additionally, these now return ssize_t results for error checking.
* Switch to C99 types (retaining compat with old compilers)Eric Wong2008-09-291-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.
* allow searching for albums with an empty tagEric Wong2008-09-291-0/+2
| | | | | | | | | | | | | | | | | | | | tfing wrote: > I have quite some files with an empty album tag as they do not come > from a particular album. > > If I want to look for those files and browse them, this happens: > :: nc localhost 6600 > OK MPD 0.12.0 > find album "" > ACK [2@0] {find} too few arguments for "find" > > I'd like to be able to browse those files in a client like gmpc. > So these 2 items would have to be developed: > - list album should report that some files have an empty tag > - it should be possible to search for an empty tag with the find command Patch-by: Marc Pavot ref: http://musicpd.org/mantis/view.php?id=464
* Replace SongList with struct songvecEric Wong2008-09-231-2/+2
| | | | | | | 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).
* use strset.h instead of tagTracker.hMax Kellermann2008-09-081-6/+17
| | | | | | | 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.
* tag: don't pass "fd" to printVisitedInTagTracker()Max Kellermann2008-09-071-1/+1
| | | | Pass the client struct instead of the raw file descriptor.
* pass "struct client" to dbUtils.c, song.c, tag_print.cMax Kellermann2008-09-071-34/+33
| | | | | | Don't pass the raw file descriptor around. This migration patch is rather large, because all of the sources have inter dependencies - we have to change all of them at the same time.
* directory: don't pass fd to traverseAllIn()Max Kellermann2008-09-071-15/+15
| | | | | | | | This patch continues the work of the previous patch: don't pass a file descriptor at all to traverseAllIn(). Since this fd was only used to report "directory not found" errors, we can easily move that check to the caller. This is a great relief, since it removes the dependency on a client connection from a lot of enumeration functions.
* directory: don't pass fd to traverseAllIn() callbacksMax Kellermann2008-09-071-36/+67
| | | | | | | | | | Database traversal should be generic, and not bound to a client connection. This is the first step: no file descriptor for the callback functions forEachSong() and forEachDir(). If a callback needs the file descriptor, it has to be passed in the void*data pointer somehow; some callbacks might need a new struct for passing more than one parameter. This might look a bit cumbersome right now, but our goal is to have a clean API.
* playlist: don't pass "fd" to storedPlaylist.c functionsMax Kellermann2008-09-071-4/+3
| | | | | Return an "enum playlist_result" value instead of calling commandError() in storedPlaylist.c.
* playlist: don't pass "fd" to playlist.c functionsMax Kellermann2008-09-071-2/+2
| | | | | | The playlist library shouldn't talk to the client if possible. Introduce the "enum playlist_result" type which the caller (i.e. command.c) may use to generate an error message.
* song: moved code to song_print.c, song_save.cMax Kellermann2008-09-071-0/+1
| | | | | | | Move everything which dumps song information (via tag_print.c) to a separate source file. song_print.c gets code which writes song data to the client; song_save.c is responsible for serializing songs from the tag cache.
* dbUtils, playlist, directory: pass constant pointersMax Kellermann2008-09-061-9/+10
| | | | The usual bunch of const pointer conversions.
* tag: converted MpdTag.items to a pointer listMax Kellermann2008-08-291-2/+2
| | | | | | This prepares the following patches, which aim to reduce MPD's memory usage: we plan to share tag_item instances, instead of just their values.
* tag: renamed MpdTag and MpdTagItem to struct tag, struct mpd_tag_itemMax Kellermann2008-08-291-1/+1
| | | | | Getting rid of CamelCase; not having typedefs also allows us to forward-declare the structures.
* converted MpdTagItem.type to an enumMax Kellermann2008-08-261-1/+1
| | | | | Don't use CPP macros when you can use C enum... this also allows better type checking.
* enable -Wpointer-arith, -Wstrict-prototypesMax Kellermann2008-08-261-9/+13
| | | | | | Also enable -Wunused-parameter - this forces us to add the gcc "unused" attribute to a lot of parameters (mostly library callback functions), but it's worth it during code refactorizations.
* eliminated duplicate initializationMax Kellermann2008-03-261-1/+1
| | | | | | | Local variables which are never read before the first assignment don't need initialization. Saves a few bytes of text. Also don't reset variables which are never read until function return. git-svn-id: https://svn.musicpd.org/mpd/trunk@7199 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* addToPlaylist/addSongToPlaylist: printId argument changed to added_idEric Wong2008-01-261-1/+1
| | | | | | | | | | | | Instead of printing out the Id from playlist.c, instead set the integer that added_id poitns to if added_id is non-NULL. This makes the API cleaner and will allow us to use additional commands to manipulate the newly-added song_id. Callers (handleAddId) that relied on printId to print it to the given fd have now been modified to print the ID at a higher-level; making playlist.c less-dependent on protocol details. git-svn-id: https://svn.musicpd.org/mpd/trunk@7149 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fixed -Wshadow warningsMax Kellermann2008-01-261-2/+2
| | | | | Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7143 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Committing pat's rewrite of the stored playlist code. This also adds twoJ. Alexander Treuman2007-05-161-1/+4
| | | | | new commands: playlistmove and playlistdelete. git-svn-id: https://svn.musicpd.org/mpd/trunk@6116 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Forgot to change the associated fdprintf format to %li.J. Alexander Treuman2007-04-261-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5952 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Changing SearchStats.playTime from int to unsigned long.J. Alexander Treuman2007-04-261-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5951 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Adding count command. It's usage is identical to find, but instead ofJ. Alexander Treuman2007-04-251-0/+44
| | | | | | returning a list of matching songs, the number of results and total play time of the results are returned. git-svn-id: https://svn.musicpd.org/mpd/trunk@5950 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* The massive copyright updateAvuton Olrich2007-04-051-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Moving a bunch of the LocateTagItem code to locate.[ch] so that it canJ. Alexander Treuman2007-02-241-187/+7
| | | | | later be used for playlist searching. git-svn-id: https://svn.musicpd.org/mpd/trunk@5419 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Moving LOCATE_TAG_{FILE,ANY}_TYPE defines to dbUtils.h, so that we canJ. Alexander Treuman2006-12-111-2/+0
| | | | | compare the return value of getLocateTagItemType() to them. git-svn-id: https://svn.musicpd.org/mpd/trunk@5138 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fixing "find any" and "list * any" to actually find matches.J. Alexander Treuman2006-12-111-2/+6
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5137 09075e82-0dd4-0310-85a5-a0d7c8717e4f