MCPcopy Create free account
hub / github.com/apache/httpd / level_cmp

Function level_cmp

modules/mappers/mod_negotiation.c:1390–1427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1388 */
1389
1390static int level_cmp(var_rec *var1, var_rec *var2)
1391{
1392 /* Levels are only comparable between matching media types */
1393
1394 if (var1->is_pseudo_html && !var2->is_pseudo_html) {
1395 return 0;
1396 }
1397
1398 if (!var1->is_pseudo_html && strcmp(var1->mime_type, var2->mime_type)) {
1399 return 0;
1400 }
1401 /* The result of the above if statements is that, if we get to
1402 * here, both variants have the same mime_type or both are
1403 * pseudo-html.
1404 */
1405
1406 /* Take highest level that matched, if either did match. */
1407
1408 if (var1->level_matched > var2->level_matched) {
1409 return 1;
1410 }
1411 if (var1->level_matched < var2->level_matched) {
1412 return -1;
1413 }
1414
1415 /* Neither matched. Take lowest level, if there's a difference. */
1416
1417 if (var1->level < var2->level) {
1418 return 1;
1419 }
1420 if (var1->level > var2->level) {
1421 return -1;
1422 }
1423
1424 /* Tied */
1425
1426 return 0;
1427}
1428
1429/* Finding languages. The main entry point is set_language_quality()
1430 * which is called for each variant. It sets two elements in the

Callers 1

is_variant_betterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected