httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaillet...@apache.org
Subject svn commit: r1823827 - in /httpd/httpd/trunk/modules/ssl: ssl_ct_util.c ssl_ct_util.h
Date Sun, 11 Feb 2018 10:41:33 GMT
Author: jailletc36
Date: Sun Feb 11 10:41:33 2018
New Revision: 1823827

URL: http://svn.apache.org/viewvc?rev=1823827&view=rev
Log:
Axe some code duplication.
Use 'ap_array_str_contains()' instead of 'ctutil_in_array()'

Modified:
    httpd/httpd/trunk/modules/ssl/ssl_ct_util.c
    httpd/httpd/trunk/modules/ssl/ssl_ct_util.h

Modified: httpd/httpd/trunk/modules/ssl/ssl_ct_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_ct_util.c?rev=1823827&r1=1823826&r2=1823827&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_ct_util.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_ct_util.c Sun Feb 11 10:41:33 2018
@@ -91,21 +91,6 @@ void ctutil_buffer_to_array(apr_pool_t *
     *out = arr;
 }
 
-int ctutil_in_array(const char *needle, const apr_array_header_t *haystack)
-{
-    const char * const *elts;
-    int i;
-
-    elts = (const char * const *)haystack->elts;
-    for (i = 0; i < haystack->nelts; i++) {
-        if (!strcmp(needle, elts[i])) {
-            return 1;
-        }
-    }
-
-    return 0;
-}
-
 apr_status_t ctutil_fopen(const char *fn, const char *mode, FILE **f)
 {
     apr_status_t rv;
@@ -674,10 +659,10 @@ void ctutil_run_internal_tests(apr_pool_
 
     ctutil_buffer_to_array(p, filecontents, strlen(filecontents), &arr);
     
-    ap_assert(ctutil_in_array(TESTURL1, arr));
-    ap_assert(ctutil_in_array(TESTURL2, arr));
-    ap_assert(ctutil_in_array(TESTURL3, arr));
-    ap_assert(!ctutil_in_array(TESTURL1 "x", arr));
+    ap_assert(ap_array_str_contains(arr, TESTURL1));
+    ap_assert(ap_array_str_contains(arr, TESTURL2));
+    ap_assert(ap_array_str_contains(arr, TESTURL3));
+    ap_assert(!ap_array_str_contains(arr, TESTURL1 "x"));
 
     ch = buf;
     avail = 8;

Modified: httpd/httpd/trunk/modules/ssl/ssl_ct_util.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_ct_util.h?rev=1823827&r1=1823826&r2=1823827&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_ct_util.h (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_ct_util.h Sun Feb 11 10:41:33 2018
@@ -29,8 +29,6 @@ int ctutil_file_exists(apr_pool_t *p, co
 void ctutil_buffer_to_array(apr_pool_t *p, const char *b,
                             apr_size_t b_size, apr_array_header_t **out);
 
-int ctutil_in_array(const char *needle, const apr_array_header_t *haystack);
-
 apr_status_t ctutil_fopen(const char *fn, const char *mode, FILE **f);
 
 apr_status_t ctutil_read_dir(apr_pool_t *p,



Mime
View raw message