trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traflm <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #703: [TRAFODION-2208] function support: lo...
Date Thu, 15 Sep 2016 09:52:50 GMT
Github user traflm commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/703#discussion_r78925592
  
    --- Diff: core/sql/exp/exp_function.cpp ---
    @@ -7724,5 +7753,354 @@ Lng32 ExFunctionExtractColumns::unpack (void * base, void * reallocator)
        if (extractColList_.unpack(base)) return -1;
        return unpackClause(base, reallocator);
     }
    +
    +//helper function, convert a string into IPV4 , if valid, it can support leading and
padding space
    +static Lng32 string2ipv4(char *srcData, Lng32 slen, unsigned int *inet_addr)
    +{
    +   Int16 i = 0, j = 0 , p=0, leadingspace=0;
    +   char buf[16]; 
    +   Int16 dot=0;
    +
    +   if(slen < MIN_IPV4_STRING_LEN ) 
    +     return 0;
    +
    +   unsigned char *ipv4_bytes= (unsigned char *)inet_addr;
    +
    +   if(srcData[0] == ' ')
    +   { 
    +     leadingspace++;
    +     for(i=1; i< slen; i++)
    +     {
    +       if(srcData[i] == ' ') leadingspace++;
    +       else break; 
    +     }
    +   }
    --- End diff --
    
    Much better, I appreciate your nicer code.


---
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