diff options
-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; } |