]> granicus.if.org Git - apache/commitdiff
Use 'ap_array_str_contains' to simplify code.
authorChristophe Jaillet <jailletc36@apache.org>
Fri, 11 Dec 2015 04:17:42 +0000 (04:17 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Fri, 11 Dec 2015 04:17:42 +0000 (04:17 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1719252 13f79535-47bb-0310-9956-ffa450edef68

modules/mappers/mod_negotiation.c

index a165d8752166dacf457a24ee0c70e6c0589fd993..aaa55ca3e8364777496ef99a709e85f8c091fe94 100644 (file)
@@ -2238,20 +2238,14 @@ static int is_variant_better(negotiation_state *neg, var_rec *variant,
  */
 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;