mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	sink, source: Always create a hashmap for ports.
Having the hashmap sometimes NULL requires a lot of checking here and there, so ensuring that the hashmap is always non-NULL simplifies the code.
This commit is contained in:
		
							parent
							
								
									21c6c70438
								
							
						
					
					
						commit
						1a6da64b16
					
				
					 10 changed files with 56 additions and 66 deletions
				
			
		| 
						 | 
				
			
			@ -2073,13 +2073,10 @@ static void connect_ports(struct userdata *u, void *sink_or_source_new_data, pa_
 | 
			
		|||
    } data;
 | 
			
		||||
    pa_device_port *port;
 | 
			
		||||
 | 
			
		||||
    if (direction == PA_DIRECTION_OUTPUT) {
 | 
			
		||||
    if (direction == PA_DIRECTION_OUTPUT)
 | 
			
		||||
        data.sink_new_data = sink_or_source_new_data;
 | 
			
		||||
        data.sink_new_data->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
 | 
			
		||||
    } else {
 | 
			
		||||
    else
 | 
			
		||||
        data.source_new_data = sink_or_source_new_data;
 | 
			
		||||
        data.source_new_data->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    switch (u->profile) {
 | 
			
		||||
        case PROFILE_A2DP:
 | 
			
		||||
| 
						 | 
				
			
			@ -2118,7 +2115,7 @@ static void connect_ports(struct userdata *u, void *sink_or_source_new_data, pa_
 | 
			
		|||
 | 
			
		||||
        default:
 | 
			
		||||
            pa_assert_not_reached();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Run from main thread */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue