Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
duk_api_buffer.c File Reference
#include "duk_internal.h"

Go to the source code of this file.

Functions

DUK_EXTERNAL void * duk_resize_buffer (duk_context *ctx, duk_idx_t index, duk_size_t new_size)
 
DUK_EXTERNAL void * duk_steal_buffer (duk_context *ctx, duk_idx_t index, duk_size_t *out_size)
 
DUK_EXTERNAL void duk_config_buffer (duk_context *ctx, duk_idx_t index, void *ptr, duk_size_t len)
 

Function Documentation

◆ duk_config_buffer()

DUK_EXTERNAL void duk_config_buffer ( duk_context * ctx,
duk_idx_t index,
void * ptr,
duk_size_t len )

Definition at line 57 of file duktape-1.5.2/src-separate/duk_api_buffer.c.

57 {
58 duk_hthread *thr = (duk_hthread *) ctx;
60
61 DUK_ASSERT(ctx != NULL);
62
64 DUK_ASSERT(h != NULL);
65
68 }
70
73}
guint index
#define DUK_ERROR_TYPE(thr, msg)
#define DUK_HBUFFER_EXTERNAL_SET_SIZE(x, v)
DUK_INTERNAL_DECL duk_hbuffer * duk_require_hbuffer(duk_context *ctx, duk_idx_t index)
#define DUK_STR_WRONG_BUFFER_TYPE
#define DUK_HBUFFER_EXTERNAL_SET_DATA_PTR(heap, x, v)
#define DUK_HBUFFER_HAS_EXTERNAL(x)
#define DUK_HBUFFER_HAS_DYNAMIC(x)
#define NULL
Definition gmacros.h:924

References DUK_ASSERT, DUK_ERROR_TYPE, DUK_HBUFFER_EXTERNAL_SET_DATA_PTR, DUK_HBUFFER_EXTERNAL_SET_SIZE, DUK_HBUFFER_HAS_DYNAMIC, DUK_HBUFFER_HAS_EXTERNAL, duk_require_hbuffer(), DUK_STR_WRONG_BUFFER_TYPE, duk_hthread::heap, index, and NULL.

◆ duk_resize_buffer()

DUK_EXTERNAL void * duk_resize_buffer ( duk_context * ctx,
duk_idx_t index,
duk_size_t new_size )

Definition at line 7 of file duktape-1.5.2/src-separate/duk_api_buffer.c.

7 {
8 duk_hthread *thr = (duk_hthread *) ctx;
10
12
14 DUK_ASSERT(h != NULL);
15
18 }
19
20 /* maximum size check is handled by callee */
21 duk_hbuffer_resize(thr, h, new_size);
22
24}
#define DUK_HBUFFER_DYNAMIC_GET_DATA_PTR(heap, x)
#define DUK_ASSERT_CTX_VALID(ctx)
DUK_INTERNAL_DECL void duk_hbuffer_resize(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t new_size)

References DUK_ASSERT, DUK_ASSERT_CTX_VALID, DUK_ERROR_TYPE, DUK_HBUFFER_DYNAMIC_GET_DATA_PTR, DUK_HBUFFER_HAS_DYNAMIC, DUK_HBUFFER_HAS_EXTERNAL, duk_hbuffer_resize(), duk_require_hbuffer(), DUK_STR_WRONG_BUFFER_TYPE, duk_hthread::heap, index, and NULL.

◆ duk_steal_buffer()

DUK_EXTERNAL void * duk_steal_buffer ( duk_context * ctx,
duk_idx_t index,
duk_size_t * out_size )

Definition at line 26 of file duktape-1.5.2/src-separate/duk_api_buffer.c.

26 {
27 duk_hthread *thr = (duk_hthread *) ctx;
29 void *ptr;
30 duk_size_t sz;
31
32 DUK_ASSERT(ctx != NULL);
33
35 DUK_ASSERT(h != NULL);
36
39 }
40
41 /* Forget the previous allocation, setting size to 0 and alloc to
42 * NULL. Caller is responsible for freeing the previous allocation.
43 * Getting the allocation and clearing it is done in the same API
44 * call to avoid any chance of a realloc.
45 */
48 if (out_size) {
49 *out_size = sz;
50 }
53
54 return ptr;
55}
#define DUK_HBUFFER_DYNAMIC_GET_SIZE(x)
#define DUK_HBUFFER_DYNAMIC_SET_SIZE(x, v)
#define DUK_HBUFFER_DYNAMIC_SET_DATA_PTR_NULL(heap, x)

References DUK_ASSERT, DUK_ERROR_TYPE, DUK_HBUFFER_DYNAMIC_GET_DATA_PTR, DUK_HBUFFER_DYNAMIC_GET_SIZE, DUK_HBUFFER_DYNAMIC_SET_DATA_PTR_NULL, DUK_HBUFFER_DYNAMIC_SET_SIZE, DUK_HBUFFER_HAS_DYNAMIC, DUK_HBUFFER_HAS_EXTERNAL, duk_require_hbuffer(), DUK_STR_WRONG_BUFFER_TYPE, duk_hthread::heap, index, and NULL.