예제 #1
0
void write_sizes(const char * to_file) {
  FILE *f = fopen(to_file, "wt");
  fputs(VFILESIZE_FILE_TYPE /**/ "\n", f);
  fputs(VFILESIZE_FILE_VERSION /**/ "\n", f);
  hash_iter_t it;
  it = vfilesize_hash_iter(SIZE_HASH);
  while (!hash_iter_end(it)) {
    vfile_size_t *e = vfilesize_hash_get(SIZE_HASH, hash_iter_key(it) );
    if (e != NULL) {
      fprintf(f, "%s\n%lu\n%lu\n", hash_iter_key(it),
                  (unsigned long) e->size, (unsigned long) e->mtime );
    } else {
      log_debug("Unexpected!");
    }
    it = hash_iter_next(it);
  }
  fclose(f);
}
예제 #2
0
static void dump_macro_set(MACRO_SET & set, MyString & str, const char * prefix) {
	str.clear();
	HASHITER it = hash_iter_begin(set, HASHITER_NO_DEFAULTS | HASHITER_SHOW_DUPS);
	while( ! hash_iter_done(it)) {
		const char *name = hash_iter_key(it);
		const char *val = hash_iter_value(it);
		//const MACRO_META *met = hash_iter_meta(it);
		if (prefix) str += prefix;
		str += name;
		str += "=";
		str += val ? val : "";
		str += "\n";
		hash_iter_next(it);
	}
	hash_iter_delete(&it);
}