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:
Peter Hutterer 2021-05-18 11:36:13 +10:00
parent d8a9534a9a
commit 7697ed0757
130 changed files with 817 additions and 675 deletions

View file

@ -22,6 +22,8 @@
* DEALINGS IN THE SOFTWARE.
*/
#include <spa/utils/string.h>
#define VOLUME_MUTED ((uint32_t) 0U)
#define VOLUME_NORM ((uint32_t) 0x10000U)
#define VOLUME_MAX ((uint32_t) UINT32_MAX/2)
@ -82,8 +84,8 @@ static inline const struct str_map *str_map_find(const struct str_map *map, cons
{
uint32_t i;
for (i = 0; map[i].pw_str; i++)
if ((pw && strcmp(map[i].pw_str, pw) == 0) ||
(pa && strcmp(map[i].pa_str, pa) == 0))
if ((pw && spa_streq(map[i].pw_str, pw)) ||
(pa && spa_streq(map[i].pa_str, pa)))
return &map[i];
return NULL;
}
@ -569,9 +571,9 @@ static void add_stream_group(struct message *m, struct spa_dict *dict, const cha
if (media_class == NULL)
return;
if (strcmp(media_class, "Stream/Output/Audio") == 0)
if (spa_streq(media_class, "Stream/Output/Audio"))
prefix = "sink-input";
else if (strcmp(media_class, "Stream/Input/Audio") == 0)
else if (spa_streq(media_class, "Stream/Input/Audio"))
prefix = "source-output";
else
return;
@ -614,9 +616,9 @@ static void write_dict(struct message *m, struct spa_dict *dict, bool remap)
(map = str_map_find(map->child, val, NULL)) != NULL)
val = map->pa_str;
}
if (strcmp(key, "media.class") == 0)
if (spa_streq(key, "media.class"))
media_class = val;
if (strcmp(key, "media.role") == 0)
if (spa_streq(key, "media.role"))
media_role = val;
write_string(m, key);