int stat_cache_delete_older(stat_cache_t *cache, const char *path_prefix, unsigned int minimum_local_generation) { struct stat_cache_iterator *iter; struct stat_cache_entry *entry; log_print(LOG_DEBUG, "stat_cache_delete_older: %s", path_prefix); iter = stat_cache_iter_init(cache, path_prefix); while ((entry = stat_cache_iter_current(iter))) { if (entry->value->local_generation < minimum_local_generation) { stat_cache_delete(cache, key2path(entry->key)); } free(entry); stat_cache_iter_next(iter); } stat_cache_iterator_free(iter); return 0; }
int r2c_main(int ac, char **av) { int c; char *file = 0; char *p; int rc = 1; int product = 1; MDBM *idDB, *goneDB; MDBM *md5DB = 0; RANGE rargs = {0}; char *sfile; char **revs = 0; longopt lopts[] = { { "standalone", 'S' }, /* treat comps as standalone */ { 0, 0 } }; while ((c = getopt(ac, av, "PRr;S", lopts)) != -1) { switch (c) { case 'P': break; // do not doc case 'R': // do not doc case 'S': product = 0; break; case 'r': if (range_addArg(&rargs, optarg, 0)) usage(); break; default: usage(); break; } } unless ((file = av[optind]) && !av[optind+1]) usage(); sfile = name2sccs(file); if (!isreg(sfile) && isKey(file)) { proj_cd2root(); idDB = loadDB(IDCACHE, 0, DB_IDCACHE); goneDB = loadDB(GONE, 0, DB_GONE); file = key2path(file, idDB, goneDB, &md5DB); mdbm_close(idDB); mdbm_close(goneDB); mdbm_close(md5DB); unless (file) goto out; }