Github user zellerh commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/17#discussion_r33946746
  
    --- Diff: core/sql/export/NAStringDef.cpp ---
    @@ -347,6 +347,143 @@ NAString::resize(size_t N)
       fbstring_.resize(N, ' ');                        // Shrank; truncate the 
string
     }
     
    +NAList<NAString> & NAString::split(char delim, NAList<NAString> & elems)
    +{
    +  int begin = 0;
    +  int end = 0;
    +  bool delim_found = false;
    +  elems.clear();
    +  end = fbstring_.find_first_of(delim, begin);
    +  while(end >= begin)
    +  {
    +     NAString word(fbstring_.data() + begin,  end - begin);
    +     elems.insert(word);
    +     begin = end + 1;
    +     end = fbstring_.find_first_of(delim, begin);
    +     delim_found = true;
    +  }
    +
    +  if(fbstring_.size() > 0)
    +  {
    +    NAString end_word(fbstring_.data()+begin, fbstring_.size()-begin);
    +    elems.insert(end_word);
    +  }
    +  
    +  return elems;
    +}
    +
    +Int32 NAString::readFile(ifstream& in) // Read to EOF or null character.
    +{
    +    char c;
    +    Int32 char_count = 0;
    +    fbstring_ = "";
    +    c = in.get();
    +    while(c != '\0' && c!=EOF)
    +    {
    +        fbstring_.append(1, c);
    +        c = in.get();
    +        char_count++;
    +    }
    +    return char_count;
    +}
    +
    +Int32 NAString::readLine(ifstream& in)   // Read to EOF or newline.
    +{
    +    char c;
    +    Int32 char_count = 0;
    +    fbstring_ = "";
    +    c = in.get();
    +    while(c != '\0' && c!='\n' && c!=EOF)
    +    {
    +        fbstring_.append(1, c);
    +        c = in.get();
    +        char_count++;
    +    }
    +    return char_count;
    +}
    +
    +Int32 NAString::readToDelim(ifstream& in, char delim) // Read to EOF or 
delimitor.
    +{
    +    char c;
    +    Int32 char_count = 0;
    +    fbstring_ = "";
    +    c = in.get();
    +    while(c != '\0' && c!=delim && c!=EOF)
    +    {
    +        fbstring_.append(1, c);
    +        c = in.get();
    +        char_count++;
    +    }
    +    return char_count;
    +}
    +
    +//This static function calculates and allocates buffer for the printf-like 
formatted string,
    +//and the formatted string is copied to buffer.
    +char* NAString::buildBuffer(const char* formatTemplate, va_list args)
    +{
    +  // calculate needed bytes to allocate memory from system heap.
    +  int bufferSize = 20049;
    +  int msgSize = 0;
    +  //buffer is managed by this static function
    +  static __thread char *buffer = NULL;
    --- End diff --
    
    Should use the THREAD_P macro defined in Platform.h here instead of 
__thread.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to