mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	spa: add spa_json_begin
That combines spa_json_init() and spa_json_next, a common thing to do.
This commit is contained in:
		
							parent
							
								
									08057e0328
								
							
						
					
					
						commit
						feccb882b6
					
				
					 7 changed files with 15 additions and 18 deletions
				
			
		| 
						 | 
				
			
			@ -66,8 +66,7 @@ static int do_merge_section(void *data, const char *location, const char *sectio
 | 
			
		|||
	int l;
 | 
			
		||||
	const char *value;
 | 
			
		||||
 | 
			
		||||
	spa_json_init(&it[0], str, len);
 | 
			
		||||
	if ((l = spa_json_next(&it[0], &value)) <= 0)
 | 
			
		||||
	if ((l = spa_json_begin(&it[0], str, len, &value)) <= 0)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	if (spa_json_is_array(value, l)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1144,8 +1144,7 @@ static void json_dump(struct data *d, const char *key, const char *value)
 | 
			
		|||
	struct spa_json it[1];
 | 
			
		||||
	int len;
 | 
			
		||||
	const char *val;
 | 
			
		||||
	spa_json_init(&it[0], value, strlen(value));
 | 
			
		||||
	if ((len = spa_json_next(&it[0], &val)) >= 0)
 | 
			
		||||
	if ((len = spa_json_begin(&it[0], value, strlen(value), &val)) >= 0)
 | 
			
		||||
		json_dump_val(d, key, &it[0], val, len);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue