• Steven Rostedt (VMware)'s avatar
    tracing: Clean up alloc_synth_event() · 9528c195
    Steven Rostedt (VMware) authored
    alloc_synth_event() currently has the following code to initialize the
    event fields and dynamic_fields:
    
    	for (i = 0, j = 0; i < n_fields; i++) {
    		event->fields[i] = fields[i];
    
    		if (fields[i]->is_dynamic) {
    			event->dynamic_fields[j] = fields[i];
    			event->dynamic_fields[j]->field_pos = i;
    			event->dynamic_fields[j++] = fields[i];
    			event->n_dynamic_fields++;
    		}
    	}
    
    1) It would make more sense to have all fields keep track of their
       field_pos.
    
    2) event->dynmaic_fields[j] is assigned twice for no reason.
    
    3) We can move updating event->n_dynamic_fields outside the loop, and just
       assign it to j.
    
    This combination makes the code much cleaner.
    
    Link: https://lkml.kernel.org/r/20210721195341.29bb0f77@oasis.local.homeSigned-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
    9528c195
trace_events_synth.c 53.1 KB