<commit_before>#include "onig-searcher.h"
#include "unicode-utils.h"

shared_ptr<OnigResult> OnigSearcher::Search(string stringToSearch, wchar_t* utf16StringToSearch, bool hasMultibyteCharacters, int charOffset) {
  int byteOffset = charOffset;
  if (hasMultibyteCharacters) {
#ifdef _WIN32
    byteOffset = UnicodeUtils::bytes_in_characters(utf16StringToSearch.get(), charOffset);
#else
    byteOffset = UnicodeUtils::bytes_in_characters(stringToSearch.data(), charOffset);
#endif
  }

  int bestLocation = 0;
  shared_ptr<OnigResult> bestResult;
  cache.Init(stringToSearch, byteOffset);

  vector< shared_ptr<OnigRegExp> >::iterator iter = regExps.begin();
  while (iter < regExps.end()) {
    OnigRegExp *regExp = (*iter).get();
    shared_ptr<OnigResult> result = cache.Search(regExp, stringToSearch, byteOffset);
    if (result != NULL && result->Count() > 0) {
      int location = result->LocationAt(0);
      if (hasMultibyteCharacters) {
        location =  UnicodeUtils::characters_in_bytes(stringToSearch.data(), location);<commit_msg>Remove unneeded get() call<commit_after>#include "onig-searcher.h"
#include "unicode-utils.h"

shared_ptr<OnigResult> OnigSearcher::Search(string stringToSearch, wchar_t* utf16StringToSearch, bool hasMultibyteCharacters, int charOffset) {
  int byteOffset = charOffset;
  if (hasMultibyteCharacters) {
#ifdef _WIN32
    byteOffset = UnicodeUtils::bytes_in_characters(utf16StringToSearch, charOffset);
#else
    byteOffset = UnicodeUtils::bytes_in_characters(stringToSearch.data(), charOffset);
#endif
  }

  int bestLocation = 0;
  shared_ptr<OnigResult> bestResult;
  cache.Init(stringToSearch, byteOffset);

  vector< shared_ptr<OnigRegExp> >::iterator iter = regExps.begin();
  while (iter < regExps.end()) {
    OnigRegExp *regExp = (*iter).get();
    shared_ptr<OnigResult> result = cache.Search(regExp, stringToSearch, byteOffset);
    if (result != NULL && result->Count() > 0) {
      int location = result->LocationAt(0);
      if (hasMultibyteCharacters) {
        location =  UnicodeUtils::characters_in_bytes(stringToSearch.data(), location);
{'fraction_non_alphanumeric': 0.12327463112803427, 'fraction_numerical': 0.008567348881485007, 'mean_word_length': 5.673015873015873, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5070526', 'n_tokens_mistral': 705, 'n_tokens_neox': 685, 'n_words': 130}