directory: don't query database during load
Don't use db_get_directory() and traverse the full path with every directory being loaded. Just see if the current parent contains the entry. Everything else would be invalid anyway..
This commit is contained in:
		| @@ -18,7 +18,6 @@ | |||||||
|  |  | ||||||
| #include "directory_save.h" | #include "directory_save.h" | ||||||
| #include "directory.h" | #include "directory.h" | ||||||
| #include "database.h" |  | ||||||
| #include "song.h" | #include "song.h" | ||||||
| #include "log.h" | #include "log.h" | ||||||
| #include "path.h" | #include "path.h" | ||||||
| @@ -88,7 +87,8 @@ directory_load(FILE *fp, struct directory *directory) | |||||||
| 				FATAL("Wrong path in database: '%s' in '%s'\n", | 				FATAL("Wrong path in database: '%s' in '%s'\n", | ||||||
| 				      name, directory->path); | 				      name, directory->path); | ||||||
|  |  | ||||||
| 			if ((subdir = db_get_directory(name))) { | 			subdir = directory_get_child(directory, name); | ||||||
|  | 			if (subdir != NULL) { | ||||||
| 				assert(subdir->parent == directory); | 				assert(subdir->parent == directory); | ||||||
| 			} else { | 			} else { | ||||||
| 				subdir = directory_new(name, directory); | 				subdir = directory_new(name, directory); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann