sgilmore10 opened a new pull request, #36485:
URL: https://github.com/apache/arrow/pull/36485
<!--
Thanks for opening a pull request!
If this is your first pull request you can find detailed information on how
to contribute here:
* [New Contributor's
Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
* [Contributing
Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
If this is not a [minor
PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes).
Could you open an issue for this pull request on GitHub?
https://github.com/apache/arrow/issues/new/choose
Opening GitHub issues ahead of time contributes to the
[Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.)
of the Apache Arrow project.
Then could you also rename the pull request title in the following format?
GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
or
MINOR: [${COMPONENT}] ${SUMMARY}
In the case of PARQUET issues on JIRA the title also supports:
PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
-->
### Rationale for this change
As @kou pointed out in #36366, it's better to pass read-only string data via
as string_views than as const references. I recently submitted two new
functions called `UTF8StringToUTF16` and `UTF16StringToUTF8`, both of which
accept const references. This PR changes the signatures of those functions to
accept string_views.
### What changes are included in this PR?
Changed the function signatures of `UTF8StringToUTF16` and
`UTF16StringToUTF8`:
1. `arrow::Result<std::u16string> UTF8StringToUTF16(const std::string&
source)` ->
`arrow::Result<std::u16string> UTF8StringToUTF16(std::string_view
source)`
2. `arrow::Result<std::string> UTF16StringToUTF8(const std::u16string&
source)` ->
`arrow::Result<std::string> UTF16StringToUTF8(std::u16string_view
source)`
<!--
There is no need to duplicate the description in the issue here but it is
sometimes worth providing a summary of the individual changes in this PR.
-->
### Are these changes tested?
Uses existing tests in `utf8_util_test.cc`
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
4. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are
they covered by existing tests)?
-->
### Are there any user-facing changes?
No.
Only the MATLAB Interface uses these functions, so I don't expect these
changes to break anyone's code:
1. Search
[results](https://github.com/search?q=repo%3Aapache%2Farrow%20UTF8StringToUTF16&type=code)
for `UTF8StringToUTF16`
2. Search
[results](https://github.com/search?q=repo%3Aapache%2Farrow+UTF16StringToUTF8&type=code)
for `UTF16StringToUTF8`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]