[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rockbox-cvs
Subject:    learman: r21576 - trunk/apps
From:       mailer () svn ! rockbox ! org
Date:       2009-06-30 17:39:03
Message-ID: 200906301739.n5UHd3Zk023143 () giant ! haxx ! se
[Download RAW message or body]

Date: 2009-06-30 19:39:03 +0200 (Tue, 30 Jun 2009)
New Revision: 21576

Log Message:
Small change to significantly reduce stack usage during database scanning. This should fix FS#10396.

Modified:
   trunk/apps/tagcache.c

Modified: trunk/apps/tagcache.c
===================================================================
--- trunk/apps/tagcache.c	2009-06-30 12:35:28 UTC (rev 21575)
+++ trunk/apps/tagcache.c	2009-06-30 17:39:03 UTC (rev 21576)
@@ -4091,13 +4091,30 @@
     return true;
 }
 
+
+/* Note that this function must not be inlined, otherwise the whole point
+ * of having the code in a separate function is lost.
+ */
+static void __attribute__ ((noinline)) check_ignore(const char *dirname,
+    int *ignore, int *unignore)
+{
+    char newpath[MAX_PATH];
+
+    /* check for a database.ignore file */
+    snprintf(newpath, MAX_PATH, "%s/database.ignore", dirname);
+    *ignore = file_exists(newpath);
+    /* check for a database.unignore file */
+    snprintf(newpath, MAX_PATH, "%s/database.unignore", dirname);
+    *unignore = file_exists(newpath);
+}
+
+
 static bool check_dir(const char *dirname, int add_files)
 {
     DIR *dir;
     int len;
     int success = false;
     int ignore, unignore;
-    char newpath[MAX_PATH];
 
     dir = opendir(dirname);
     if (!dir)
@@ -4106,12 +4123,8 @@
         return false;
     }
     
-    /* check for a database.ignore file */
-    snprintf(newpath, MAX_PATH, "%s/database.ignore", dirname);
-    ignore = file_exists(newpath);
-    /* check for a database.unignore file */
-    snprintf(newpath, MAX_PATH, "%s/database.unignore", dirname);
-    unignore = file_exists(newpath);
+    /* check for a database.ignore and database.unignore */
+    check_ignore(dirname, &ignore, &unignore);
 
     /* don't do anything if both ignore and unignore are there */
     if (ignore != unignore)

_______________________________________________
rockbox-cvs mailing list
rockbox-cvs@cool.haxx.se
http://cool.haxx.se/cgi-bin/mailman/listinfo/rockbox-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic