mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	spa: bluez: use switch
Use a switch statement instead of an `if` because it is more suitable in the presence of `#ifdef`s, it avoids potential unnecessary extra checks.
This commit is contained in:
		
							parent
							
								
									73690d6662
								
							
						
					
					
						commit
						4cf889a5f0
					
				
					 1 changed files with 12 additions and 4 deletions
				
			
		| 
						 | 
					@ -1042,18 +1042,26 @@ static void rfcomm_event(struct spa_source *source)
 | 
				
			||||||
		buf[len] = 0;
 | 
							buf[len] = 0;
 | 
				
			||||||
		spa_log_debug(backend->log, "RFCOMM << %s", buf);
 | 
							spa_log_debug(backend->log, "RFCOMM << %s", buf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							switch (rfcomm->profile) {
 | 
				
			||||||
#ifdef HAVE_BLUEZ_5_BACKEND_HSP_NATIVE
 | 
					#ifdef HAVE_BLUEZ_5_BACKEND_HSP_NATIVE
 | 
				
			||||||
		if (rfcomm->profile == SPA_BT_PROFILE_HSP_HS)
 | 
							case SPA_BT_PROFILE_HSP_HS:
 | 
				
			||||||
			res = rfcomm_hsp_ag(source, buf);
 | 
								res = rfcomm_hsp_ag(source, buf);
 | 
				
			||||||
		else if (rfcomm->profile == SPA_BT_PROFILE_HSP_AG)
 | 
								break;
 | 
				
			||||||
 | 
							case SPA_BT_PROFILE_HSP_AG:
 | 
				
			||||||
			res = rfcomm_hsp_hs(source, buf);
 | 
								res = rfcomm_hsp_hs(source, buf);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef HAVE_BLUEZ_5_BACKEND_HFP_NATIVE
 | 
					#ifdef HAVE_BLUEZ_5_BACKEND_HFP_NATIVE
 | 
				
			||||||
		if (rfcomm->profile == SPA_BT_PROFILE_HFP_HF)
 | 
							case SPA_BT_PROFILE_HFP_HF:
 | 
				
			||||||
			res = rfcomm_hfp_ag(source, buf);
 | 
								res = rfcomm_hfp_ag(source, buf);
 | 
				
			||||||
		else if (rfcomm->profile == SPA_BT_PROFILE_HFP_AG)
 | 
								break;
 | 
				
			||||||
 | 
							case SPA_BT_PROFILE_HFP_AG:
 | 
				
			||||||
			res = rfcomm_hfp_hf(source, buf);
 | 
								res = rfcomm_hfp_hf(source, buf);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
							default:
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!res) {
 | 
							if (!res) {
 | 
				
			||||||
			spa_log_debug(backend->log, "RFCOMM receive unsupported command: %s", buf);
 | 
								spa_log_debug(backend->log, "RFCOMM receive unsupported command: %s", buf);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue