httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaillet...@apache.org
Subject svn commit: r1719252 - /httpd/httpd/trunk/modules/mappers/mod_negotiation.c
Date Fri, 11 Dec 2015 04:17:42 GMT
Author: jailletc36
Date: Fri Dec 11 04:17:42 2015
New Revision: 1719252

URL: http://svn.apache.org/viewvc?rev=1719252&view=rev
Log:
Use 'ap_array_str_contains' to simplify code.

Modified:
    httpd/httpd/trunk/modules/mappers/mod_negotiation.c

Modified: httpd/httpd/trunk/modules/mappers/mod_negotiation.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_negotiation.c?rev=1719252&r1=1719251&r2=1719252&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_negotiation.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_negotiation.c Fri Dec 11 04:17:42 2015
@@ -2238,20 +2238,14 @@ static int is_variant_better(negotiation
  */
 static int variant_has_language(var_rec *variant, const char *lang)
 {
-    int j, max;
-
     /* fast exit */
     if (   !lang
-        || !variant->content_languages
-        || !(max = variant->content_languages->nelts)) {
+        || !variant->content_languages) {
         return 0;
     }
 
-    for (j = 0; j < max; ++j) {
-        if (!strcmp(lang,
-                    ((char **) (variant->content_languages->elts))[j])) {
-            return 1;
-        }
+    if (ap_array_str_contains(variant->content_languages, lang)) {
+        return 1;
     }
 
     return 0;



Mime
View raw message