From 659a543da853bcb28c22df300a93bd22dc9ae877 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 29 Sep 2008 02:48:09 -0700 Subject: update: move path sanitation up the stack to avoid extra copies Remove yet another use of our old malloc-happy linked list implementation and replace it with a simple array of strings. This also implements more eager error handling of invalid paths (still centralized in updateInit) so we can filter out bad paths before we spawn a thread. This also does its part to fix the "update" command inside list mode which lost its static variable in ada24f9a921ff95d874195acf253b5a9dd12213d (although it was broken and requires the fix in 769939b62f7557f8e7c483223d68a8b39af43e37, too). --- src/directory.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/directory.h') diff --git a/src/directory.h b/src/directory.h index 9161efc38..eb1b35aa7 100644 --- a/src/directory.h +++ b/src/directory.h @@ -21,7 +21,6 @@ #include "song.h" #include "songvec.h" -#include "list.h" struct dirvec { struct _Directory **base; @@ -42,8 +41,13 @@ void reap_update_task(void); int isUpdatingDB(void); -/* returns the non-negative update job ID on success, -1 on error */ -int updateInit(List * pathList); +/* + * returns the non-negative update job ID on success, + * -1 if busy, -2 if invalid argument + * @argv itself is safe to free once updateInit returns, but the + * string values contained by @argv MUST NOT be freed manually + */ +int updateInit(int argc, char *argv[]); void directory_init(void); -- cgit v1.2.3