1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-09-22 04:15:54 -04:00

Rearrange/comment origins sorting. Linting

This commit is contained in:
Julien CROUZET 2017-10-10 19:20:02 +02:00 committed by Philipp Schafft
parent 85d8bd4675
commit d6941d3e93

View File

@ -2363,14 +2363,20 @@ static void _parse_cors(xmlDocPtr doc,
static void _cors_sort_origins_by_length_desc(char **origins) static void _cors_sort_origins_by_length_desc(char **origins)
{ {
int length; uint length;
char *temp; char *temp;
// If there are no origins or only one, no sort.
if (!origins || !origins[1]) { if (!origins || !origins[1]) {
return; return;
} }
// Count origins.
for (length = 0; origins[length]; length++); for (length = 0; origins[length]; length++);
// Sort origin by length, descending.
for (int step = 0; step < length; step++) for (int step = 0; step < length; step++)
{
for (int i = 0; i < length - step - 1; i++) for (int i = 0; i < length - step - 1; i++)
{ {
if (strlen(origins[i]) < strlen(origins[i+1])) if (strlen(origins[i]) < strlen(origins[i+1]))
@ -2381,6 +2387,7 @@ static void _cors_sort_origins_by_length_desc(char **origins)
} }
} }
} }
}
static int _parse_cors_path(xmlDocPtr doc, static int _parse_cors_path(xmlDocPtr doc,
xmlNodePtr node, xmlNodePtr node,