Ejemplo n.º 1
0
static const char* get_file(proc_file *pf)
{
	if (pf->last_gen != gen) {
		pf->last_gen = gen;
		readfile_z(pf, proc_name[pf - &first_proc_file]);
	}
	return pf->file;
}
Ejemplo n.º 2
0
static const char* get_file(proc_file *pf)
{
	if (pf->last_gen != gen) {
		pf->last_gen = gen;
		// We allocate PROC_FILE_SIZE bytes. This wastes memory,
		// but allows us to allocate only once (at first sample)
		// per proc file, and reuse buffer for each sample
		if (!pf->file)
			pf->file = xmalloc(PROC_FILE_SIZE);
		readfile_z(pf->file, PROC_FILE_SIZE, proc_name[pf - &first_proc_file]);
	}
	return pf->file;
}