You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2023/05/16 23:53:37 UTC
[arrow] branch main updated: GH-35617: [Docs] Current n_buffers use in C API example (#35626)
This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new aaf6259174 GH-35617: [Docs] Current n_buffers use in C API example (#35626)
aaf6259174 is described below
commit aaf62591741a2f3b4df0d84273ebdbdcb01a8005
Author: Dirk Eddelbuettel <ed...@debian.org>
AuthorDate: Tue May 16 18:53:31 2023 -0500
GH-35617: [Docs] Current n_buffers use in C API example (#35626)
### Rationale for this change
As described in #35617 the example in docs suffers from a likely copy-and-paste error as the `n_buffers` value references the _parent_ rather that the two children where this is used. `g++-12` spots this and bemoans that assigning to, respectively, `buffers[1]` and then `buffers[1]` and `buffers[2]` is out of bounds.
### What changes are included in this PR?
The example is corrected.
### Are these changes tested?
Yes, locally. The warnings under `g++-12` go away.
### Are there any user-facing changes?
Not in behavior but the documentation is improved.
* Closes: #35617
Authored-by: Dirk Eddelbuettel <ed...@debian.org>
Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
docs/source/format/CDataInterface.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/source/format/CDataInterface.rst b/docs/source/format/CDataInterface.rst
index 17a5e37cd7..fde872ff97 100644
--- a/docs/source/format/CDataInterface.rst
+++ b/docs/source/format/CDataInterface.rst
@@ -907,7 +907,7 @@ transferring ownership to the consumer:
// Bookkeeping
.release = &release_malloced_array
};
- child->buffers = malloc(sizeof(void*) * array->n_buffers);
+ child->buffers = malloc(sizeof(void*) * child->n_buffers);
child->buffers[0] = float32_nulls;
child->buffers[1] = float32_data;
@@ -927,7 +927,7 @@ transferring ownership to the consumer:
// Bookkeeping
.release = &release_malloced_array
};
- child->buffers = malloc(sizeof(void*) * array->n_buffers);
+ child->buffers = malloc(sizeof(void*) * child->n_buffers);
child->buffers[0] = utf8_nulls;
child->buffers[1] = utf8_offsets;
child->buffers[2] = utf8_data;