lidavidm commented on code in PR #12:
URL: https://github.com/apache/arrow-nanoarrow/pull/12#discussion_r941444065
##########
src/nanoarrow/typedefs_inline.h:
##########
@@ -166,6 +166,34 @@ enum ArrowType {
NANOARROW_TYPE_INTERVAL_MONTH_DAY_NANO
};
+/// \brief An non-owning view of a string
+struct ArrowStringView {
+ /// \brief A pointer to the start of the string
+ ///
+ /// If n_bytes is 0, this value may be NULL.
+ const char* data;
+
+ /// \brief The size of the string in bytes,
+ ///
+ /// (Not including the null terminator.)
+ int64_t n_bytes;
+};
+
+ /// \brief Create a string view from a null-terminated string
+static inline struct ArrowStringView ArrowCharView(const char* value) {
+ struct ArrowStringView out;
+
+ out.data = value;
+ out.n_bytes = 0;
+ if (value) {
+ while (*value++) {
Review Comment:
why not strlen? to avoid the include?
--
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]