Browse Source

API docs for duk_is_buffer_data()

pull/1221/head
Sami Vaarala 8 years ago
parent
commit
f3f07e6760
  1. 8
      website/api/buffer-null-pointer-ambiguity.html
  2. 5
      website/api/duk_is_buffer.yaml
  3. 26
      website/api/duk_is_buffer_data.yaml

8
website/api/buffer-null-pointer-ambiguity.html

@ -1,6 +1,8 @@
<div class="note">
There is no reliable way to distinguish a zero-size buffer from a non-buffer
based on the return values. A <code>NULL</code> with zero size is returned for
a non-buffer. The same values may be returned for a zero-size buffer (although
it is also possible that a non-<code>NULL</code> pointer is returned).
based on the return values alone: a <code>NULL</code> with zero size is returned
for a non-buffer. The same values may be returned for a zero-size buffer (although
it is also possible that a non-<code>NULL</code> pointer is returned). Use
<code><a href="#duk_is_buffer_data">duk_is_buffer_data()</a></code> when type
checking a buffer or a buffer object.
</div>

5
website/api/duk_is_buffer.yaml

@ -7,7 +7,7 @@ stack: |
[ ... val! ... ]
summary: |
<p>Returns 1 if value at <code>idx</code> is a buffer, otherwise
<p>Returns 1 if value at <code>idx</code> is a plain buffer, otherwise
returns 0. If <code>idx</code> is invalid, also returns 0.</p>
example: |
@ -19,4 +19,7 @@ tags:
- stack
- buffer
seealso:
- duk_is_buffer_data
introduced: 1.0.0

26
website/api/duk_is_buffer_data.yaml

@ -0,0 +1,26 @@
name: duk_is_buffer_data
proto: |
duk_bool_t duk_is_buffer_data(duk_context *ctx, duk_idx_t idx);
stack: |
[ ... val! ... ]
summary: |
<p>Returns 1 if value at <code>idx</code> is a plain buffer or any
buffer object type, otherwise returns 0. If <code>idx</code> is invalid,
also returns 0.</p>
example: |
if (duk_is_buffer_data(ctx, -3)) {
/* ... */
}
tags:
- stack
- buffer
seealso:
- duk_is_buffer
introduced: 2.0.0
Loading…
Cancel
Save