trafficserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpeach <...@git.apache.org>
Subject [GitHub] trafficserver pull request #783: TS-3816 : Replace ptr_len_cmp with memcmp
Date Tue, 05 Jul 2016 18:13:01 GMT
Github user jpeach commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/783#discussion_r69611157
  
    --- Diff: proxy/http/HttpTransact.cc ---
    @@ -762,8 +762,8 @@ HttpTransact::StartRemapRequest(State *s)
     
       const char syntxt[] = "synthetic.txt";
     
    -  s->cop_test_page = (ptr_len_cmp(host, host_len, local_host_ip_str, sizeof(local_host_ip_str)
- 1) == 0) &&
    -                     (ptr_len_cmp(path, path_len, syntxt, sizeof(syntxt) - 1) == 0) &&
    +  s->cop_test_page = (host_len == sizeof(local_host_ip_str) - 1) && (path_len
== sizeof(syntxt) - 1) &&
    +                     (memcmp(host, local_host_ip_str, host_len) == 0) && (memcmp(path,
syntxt, path_len) == 0) &&
    --- End diff --
    
    Please add a local inline helper function something like this:
    ```C
    static inline bool
    is_localhost(const char * name, int len) {
        static const char local[] = "127.0.0.1";
        return len == (sizeof(local) - 1) &&
            memcmp(name, local, len) == 0;
    }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message