src/libpfm4/lib/pfmlib_perf_event_pmu.c
/*
 * allocate space for one new event in event table
 *
 * returns NULL if out-of-memory
 *
 * may realloc existing table if necessary for growth
 */
allocate space for one new event in event table
returns NULL if out-of-memory

may realloc existing table if necessary for growth
allocate space for one new event in event table returns NULL if out - of - memory may realloc existing table if necessary for growth
static perf_event_t *
perf_table_alloc_event(void)
{
	perf_event_t *new_pe;
retry:
	if (perf_pe_free < perf_pe_end)
		return perf_pe_free++;
	perf_pe_count += PERF_ALLOC_EVENT_COUNT;
	new_pe = realloc(perf_pe, perf_pe_count * sizeof(perf_event_t));
	if (!new_pe) 
		return NULL;
	perf_pe_free = new_pe + (perf_pe_free - perf_pe);
	perf_pe_end = perf_pe_free + PERF_ALLOC_EVENT_COUNT;
	perf_pe = new_pe;
	goto retry;
}
static perf_event_t * perf_table_alloc_event ( void ) { perf_event_t * new_pe ; retry : if ( perf_pe_free < perf_pe_end ) return perf_pe_free ++ ; perf_pe_count += PERF_ALLOC_EVENT_COUNT ; new_pe = realloc ( perf_pe , perf_pe_count * sizeof ( perf_event_t ) ) ; if ( ! new_pe ) return NULL ; perf_pe_free = new_pe + ( perf_pe_free - perf_pe ) ; perf_pe_end = perf_pe_free + PERF_ALLOC_EVENT_COUNT ; perf_pe = new_pe ; goto retry ; }
allocate space for one new event in event table
 returns NULL if out-of-memory
allocate space for one new event in event table returns NULL if out - of - memory