mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	properties: add setva function
This commit is contained in:
		
							parent
							
								
									4005cf03e6
								
							
						
					
					
						commit
						eb8b1fd421
					
				
					 2 changed files with 15 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -291,6 +291,15 @@ int pw_properties_set(struct pw_properties *properties, const char *key, const c
 | 
			
		|||
	return do_replace(properties, strdup(key), value ? strdup(value) : NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
pw_properties_setva(struct pw_properties *properties,
 | 
			
		||||
		   const char *key, const char *format, va_list args)
 | 
			
		||||
{
 | 
			
		||||
	char *value;
 | 
			
		||||
	vasprintf(&value, format, args);
 | 
			
		||||
	return do_replace(properties, strdup(key), value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Set a property value by format
 | 
			
		||||
 *
 | 
			
		||||
 * \param properties a \ref pw_properties
 | 
			
		||||
| 
						 | 
				
			
			@ -305,14 +314,14 @@ int pw_properties_set(struct pw_properties *properties, const char *key, const c
 | 
			
		|||
 */
 | 
			
		||||
int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format, ...)
 | 
			
		||||
{
 | 
			
		||||
	int res;
 | 
			
		||||
	va_list varargs;
 | 
			
		||||
	char *value;
 | 
			
		||||
 | 
			
		||||
	va_start(varargs, format);
 | 
			
		||||
	vasprintf(&value, format, varargs);
 | 
			
		||||
	res = pw_properties_setva(properties, key, format, varargs);
 | 
			
		||||
	va_end(varargs);
 | 
			
		||||
 | 
			
		||||
	return do_replace(properties, strdup(key), value);
 | 
			
		||||
	return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Get a property
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,6 +64,9 @@ pw_properties_set(struct pw_properties *properties, const char *key, const char
 | 
			
		|||
int
 | 
			
		||||
pw_properties_setf(struct pw_properties *properties,
 | 
			
		||||
		   const char *key, const char *format, ...) SPA_PRINTF_FUNC(3, 4);
 | 
			
		||||
int
 | 
			
		||||
pw_properties_setva(struct pw_properties *properties,
 | 
			
		||||
		   const char *key, const char *format, va_list args);
 | 
			
		||||
const char *
 | 
			
		||||
pw_properties_get(const struct pw_properties *properties, const char *key);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue