mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
clean up some more array iterations
This commit is contained in:
parent
0b98614bea
commit
9b6e504c19
14 changed files with 88 additions and 114 deletions
|
|
@ -351,11 +351,9 @@ static const struct format_info format_info[] = {
|
|||
|
||||
static const struct format_info *fourcc_to_format_info(uint32_t fourcc)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < SPA_N_ELEMENTS(format_info); i++) {
|
||||
if (format_info[i].fourcc == fourcc)
|
||||
return &format_info[i];
|
||||
SPA_FOR_EACH_ELEMENT_VAR(format_info, i) {
|
||||
if (i->fourcc == fourcc)
|
||||
return i;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -363,11 +361,9 @@ static const struct format_info *fourcc_to_format_info(uint32_t fourcc)
|
|||
#if 0
|
||||
static const struct format_info *video_format_to_format_info(uint32_t format)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SPA_N_ELEMENTS(format_info); i++) {
|
||||
if (format_info[i].format == format)
|
||||
return &format_info[i];
|
||||
SPA_FOR_EACH_ELEMENT_VAR(format_info, i) {
|
||||
if (i->format == format)
|
||||
return i;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -381,10 +377,11 @@ static const struct format_info *find_format_info_by_media_type(uint32_t type,
|
|||
size_t i;
|
||||
|
||||
for (i = startidx; i < SPA_N_ELEMENTS(format_info); i++) {
|
||||
if ((format_info[i].media_type == type) &&
|
||||
(format_info[i].media_subtype == subtype) &&
|
||||
(format == 0 || format_info[i].format == format))
|
||||
return &format_info[i];
|
||||
const struct format_info *fi = &format_info[i];
|
||||
if ((fi->media_type == type) &&
|
||||
(fi->media_subtype == subtype) &&
|
||||
(format == 0 || fi->format == format))
|
||||
return fi;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue