paleolimbot commented on code in PR #578:
URL: https://github.com/apache/arrow-nanoarrow/pull/578#discussion_r1712056773


##########
src/nanoarrow/common/array.c:
##########
@@ -1335,3 +1335,177 @@ ArrowErrorCode ArrowArrayViewValidate(struct 
ArrowArrayView* array_view,
   ArrowErrorSet(error, "validation_level not recognized");
   return EINVAL;
 }
+
+struct ArrowComparisonInternalState {
+  enum ArrowCompareLevel level;
+  int is_equal;
+  struct ArrowBuffer path;
+  struct ArrowError reason;
+};
+
+#define RETURN_NOT_EQUAL_IMPL(state_, path_size_, cond_, reason_) \
+  do {                                                            \
+    if (cond_) {                                                  \
+      ArrowErrorSet(&state_->reason, "%s", reason_);              \
+      state_->path.size_bytes = (path_size_);                     \
+      state_->is_equal = 0;                                       \
+      return NANOARROW_OK;                                        \
+    }                                                             \
+  } while (0)
+
+#define RETURN_NOT_EQUAL(state_, path_size_, condition_) \
+  RETURN_NOT_EQUAL_IMPL(state_, path_size_, condition_, #condition_)
+
+static ArrowErrorCode ArrowArrayViewCompareStructure(
+    const struct ArrowArrayView* actual, const struct ArrowArrayView* expected,
+    struct ArrowComparisonInternalState* state) {
+  int64_t path_size = state->path.size_bytes;
+
+  RETURN_NOT_EQUAL(state, path_size, actual->storage_type != 
expected->storage_type);

Review Comment:
   I went with `SET_NOT_EQUAL_AND_RETURN_IF()` where the condition is the first 
argument. I removed `path_size` (and the path buffer as well).



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

Reply via email to