diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2006-08-04 22:52:48 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2006-08-04 22:52:48 +0000 |
commit | e16457e42864c9b0f6f5d749a15cadf9f7858c96 (patch) | |
tree | 5c0f398bde0f8f5cc51d6e2dc4e0ca09e73bbad5 | |
parent | 0d8336e1d3833c1d896e55e97fc0bcb1206ac96e (diff) | |
download | mpd-e16457e42864c9b0f6f5d749a15cadf9f7858c96.tar.gz mpd-e16457e42864c9b0f6f5d749a15cadf9f7858c96.tar.xz mpd-e16457e42864c9b0f6f5d749a15cadf9f7858c96.zip |
fix a bug in tree.c and add DEBUG() timing for closeMp3Directory
git-svn-id: https://svn.musicpd.org/mpd/branches/mpd-tree@4552 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/tree.c | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c index 81170d27e..cf34eb989 100644 --- a/src/main.c +++ b/src/main.c @@ -54,6 +54,7 @@ #include <fcntl.h> #include <pwd.h> #include <grp.h> +#include <time.h> #include <unistd.h> #define SYSTEM_CONFIG_FILE_LOCATION "/etc/mpd.conf" @@ -526,7 +527,10 @@ int main(int argc, char *argv[]) freeAllInterfaces(); closeAllListenSockets(); + clock_t start = clock(); closeMp3Directory(); + DEBUG("closeMp3Directory took %f seconds\n", + ((float)(clock()-start))/CLOCKS_PER_SEC); finishPlaylist(); freePlayerData(); diff --git a/src/tree.c b/src/tree.c index 63bed7f41..9462d2a2c 100644 --- a/src/tree.c +++ b/src/tree.c @@ -23,7 +23,7 @@ #include <string.h> #ifndef CHILDREN_PER_NODE -#define CHILDREN_PER_NODE 31 +#define CHILDREN_PER_NODE 25 #endif #define DATA_PER_NODE (CHILDREN_PER_NODE-1) @@ -121,6 +121,7 @@ _Find(TreeIterator * iter, void * key) { if (_FindPosition(iter->tree, iter->node, key, &iter->which)) { + iter->which++; return 1; } @@ -351,7 +352,7 @@ void _DeleteAt(TreeIterator * iter) { TreeNode * node = iter->node; - int pos = iter->which; + int pos = iter->which - 1; TreeKeyData * keyData = &(node->keyData[pos]); TreeKeyData keyDataToFree = *keyData; @@ -704,7 +705,6 @@ FindInTree(Tree * tree, void * key, TreeIterator * iter) _SetIteratorToRoot(tree, iter); if (_Find(iter, key)) { - iter->which++; return 1; } |