mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	consider passing the same argument twice to a module an error, also consider a variable name without following = an error
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2525 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									8dd59a6be9
								
							
						
					
					
						commit
						e9c13e25b7
					
				
					 1 changed files with 17 additions and 1 deletions
				
			
		| 
						 | 
					@ -53,6 +53,12 @@ static int add_key_value(pa_hashmap *map, char *key, char *value, const char* co
 | 
				
			||||||
    pa_assert(key);
 | 
					    pa_assert(key);
 | 
				
			||||||
    pa_assert(value);
 | 
					    pa_assert(value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (pa_hashmap_get(map, key)) {
 | 
				
			||||||
 | 
					        pa_xfree(key);
 | 
				
			||||||
 | 
					        pa_xfree(value);
 | 
				
			||||||
 | 
					        return -1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (valid_keys) {
 | 
					    if (valid_keys) {
 | 
				
			||||||
        const char*const* v;
 | 
					        const char*const* v;
 | 
				
			||||||
        for (v = valid_keys; *v; v++)
 | 
					        for (v = valid_keys; *v; v++)
 | 
				
			||||||
| 
						 | 
					@ -80,7 +86,15 @@ pa_modargs *pa_modargs_new(const char *args, const char* const* valid_keys) {
 | 
				
			||||||
    map = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
 | 
					    map = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (args) {
 | 
					    if (args) {
 | 
				
			||||||
        enum { WHITESPACE, KEY, VALUE_START, VALUE_SIMPLE, VALUE_DOUBLE_QUOTES, VALUE_TICKS } state;
 | 
					        enum {
 | 
				
			||||||
 | 
					            WHITESPACE,
 | 
				
			||||||
 | 
					            KEY,
 | 
				
			||||||
 | 
					            VALUE_START,
 | 
				
			||||||
 | 
					            VALUE_SIMPLE,
 | 
				
			||||||
 | 
					            VALUE_DOUBLE_QUOTES,
 | 
				
			||||||
 | 
					            VALUE_TICKS
 | 
				
			||||||
 | 
					        } state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const char *p, *key, *value;
 | 
					        const char *p, *key, *value;
 | 
				
			||||||
        size_t key_len = 0, value_len = 0;
 | 
					        size_t key_len = 0, value_len = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -100,6 +114,8 @@ pa_modargs *pa_modargs_new(const char *args, const char* const* valid_keys) {
 | 
				
			||||||
                case KEY:
 | 
					                case KEY:
 | 
				
			||||||
                    if (*p == '=')
 | 
					                    if (*p == '=')
 | 
				
			||||||
                        state = VALUE_START;
 | 
					                        state = VALUE_START;
 | 
				
			||||||
 | 
					                    else if (isspace(*p))
 | 
				
			||||||
 | 
					                        goto fail;
 | 
				
			||||||
                    else
 | 
					                    else
 | 
				
			||||||
                        key_len++;
 | 
					                        key_len++;
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue