mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	core: Add a string list membership check function
This adds a pa_str_in_list() to check for a given string in a space-separated list of strings. For now, this is merely present to avoid duplication of role matching code (intended roles can be a space-separate list) across modules.
This commit is contained in:
		
							parent
							
								
									667289679f
								
							
						
					
					
						commit
						06fc121eef
					
				
					 4 changed files with 23 additions and 40 deletions
				
			
		| 
						 | 
				
			
			@ -2627,6 +2627,26 @@ pa_bool_t pa_in_system_mode(void) {
 | 
			
		|||
    return !!atoi(e);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Checks a whitespace-separated list of words in haystack for needle */
 | 
			
		||||
pa_bool_t pa_str_in_list_spaces(const char *haystack, const char *needle) {
 | 
			
		||||
    char *s;
 | 
			
		||||
    const char *state = NULL;
 | 
			
		||||
 | 
			
		||||
    if (!haystack || !needle)
 | 
			
		||||
        return FALSE;
 | 
			
		||||
 | 
			
		||||
    while ((s = pa_split_spaces(haystack, &state))) {
 | 
			
		||||
        if (pa_streq(needle, s)) {
 | 
			
		||||
            pa_xfree(s);
 | 
			
		||||
            return TRUE;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        pa_xfree(s);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
char *pa_get_user_name_malloc(void) {
 | 
			
		||||
    ssize_t k;
 | 
			
		||||
    char *u;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue