mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	treewide: replace strcmp() == 0 with spa_streq()
This change is only done in source files for now, header files will be done separately.
This commit is contained in:
		
							parent
							
								
									d8a9534a9a
								
							
						
					
					
						commit
						7697ed0757
					
				
					 130 changed files with 817 additions and 675 deletions
				
			
		| 
						 | 
				
			
			@ -31,6 +31,7 @@
 | 
			
		|||
#include <math.h>
 | 
			
		||||
 | 
			
		||||
#include <spa/utils/result.h>
 | 
			
		||||
#include <spa/utils/string.h>
 | 
			
		||||
#include <spa/pod/iter.h>
 | 
			
		||||
#include <spa/debug/types.h>
 | 
			
		||||
#include <spa/utils/json.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -280,8 +281,8 @@ static void put_value(struct data *d, const char *key, const char *val)
 | 
			
		|||
 | 
			
		||||
	if (val == NULL)
 | 
			
		||||
		put_literal(d, key, "null");
 | 
			
		||||
	else if (strcmp(val, "true") == 0 ||
 | 
			
		||||
	    strcmp(val, "false") == 0)
 | 
			
		||||
	else if (spa_streq(val, "true") ||
 | 
			
		||||
	    spa_streq(val, "false"))
 | 
			
		||||
		put_literal(d, key, val);
 | 
			
		||||
	else if ((li = strtol(val, &end, 10)) != LONG_MIN &&
 | 
			
		||||
	    errno != -ERANGE && *end == '\0')
 | 
			
		||||
| 
						 | 
				
			
			@ -1109,7 +1110,7 @@ static void metadata_dump(struct object *o)
 | 
			
		|||
		put_int(d, "subject", e->subject);
 | 
			
		||||
		put_value(d, "key", e->key);
 | 
			
		||||
		put_value(d, "type", e->type);
 | 
			
		||||
		if (e->type != NULL && strcmp(e->type, "Spa:String:JSON") == 0)
 | 
			
		||||
		if (e->type != NULL && spa_streq(e->type, "Spa:String:JSON"))
 | 
			
		||||
			json_dump(d, "value", e->value);
 | 
			
		||||
		else
 | 
			
		||||
			put_value(d, "value", e->value);
 | 
			
		||||
| 
						 | 
				
			
			@ -1124,7 +1125,7 @@ static struct metadata_entry *metadata_find(struct object *o, uint32_t subject,
 | 
			
		|||
	struct metadata_entry *e;
 | 
			
		||||
	spa_list_for_each(e, &o->data_list, link) {
 | 
			
		||||
		if ((e->subject == subject) &&
 | 
			
		||||
		    (key == NULL || strcmp(e->key, key) == 0))
 | 
			
		||||
		    (key == NULL || spa_streq(e->key, key)))
 | 
			
		||||
			return e;
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -1208,7 +1209,7 @@ static const struct class *find_class(const char *type, uint32_t version)
 | 
			
		|||
{
 | 
			
		||||
	size_t i;
 | 
			
		||||
	for (i = 0; i < SPA_N_ELEMENTS(classes); i++) {
 | 
			
		||||
		if (strcmp(classes[i]->type, type) == 0 &&
 | 
			
		||||
		if (spa_streq(classes[i]->type, type) &&
 | 
			
		||||
		    classes[i]->version <= version)
 | 
			
		||||
			return classes[i];
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue