Enlightenment CVS committal Author : chaos Project : e17 Module : apps/evfs
Dir : e17/apps/evfs/src/bin Modified Files: evfs_metadata.c Log Message: DB locking fix =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/bin/evfs_metadata.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -3 -r1.39 -r1.40 --- evfs_metadata.c 3 Sep 2007 10:24:18 -0000 1.39 +++ evfs_metadata.c 4 Sep 2007 07:34:09 -0000 1.40 @@ -737,7 +737,12 @@ unsigned const char* str; int res = 0; Ecore_List* delList; + Ecore_List* keys; + int it; + Ecore_Hash* stat_hash; + + stat_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); delList = ecore_list_new(); ret = sqlite3_open(metadata_db, &dbi); @@ -768,8 +773,13 @@ res = (*EVFS_PLUGIN_FILE(file->plugin)->functions->evfs_file_stat)(proxy, &file_stat,0); if (res == 0) { - /*printf("*\n");*/ - evfs_metadata_db_record_stat(db, sqlite3_column_int(pStmt,1), &file_stat); + struct stat* cpstat; + int id; + + cpstat = NEW(struct stat); + memcpy(cpstat,&file_stat, sizeof(struct stat)); + id = sqlite3_column_int(pStmt,1); + ecore_hash_set(stat_hash, (int*)id, cpstat); } else { /*printf("DELETED\n");*/ @@ -780,6 +790,16 @@ } sqlite3_reset(pStmt); sqlite3_finalize(pStmt); + + /*Record stats*/ + keys = ecore_hash_keys(stat_hash); + while ( (it = (int)ecore_list_first_remove(keys))) { + struct stat* st = ecore_hash_get(stat_hash, (int*)it); + evfs_metadata_db_record_stat(db, it, st); + + free(st); + } + ecore_list_destroy(keys); /*If we saw no rows, we're at the end - go back * to the start*/ @@ -808,6 +828,7 @@ ecore_list_destroy(delList); sqlite3_close(dbi); + ecore_hash_destroy(stat_hash); return 1; } ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs