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

Go to the source code of this file.

Functions

DUK_INTERNAL void duk_heap_remove_any_from_heap_allocated (duk_heap *heap, duk_heaphdr *hdr)
 
DUK_INTERNAL void duk_heap_insert_into_heap_allocated (duk_heap *heap, duk_heaphdr *hdr)
 

Function Documentation

◆ duk_heap_insert_into_heap_allocated()

DUK_INTERNAL void duk_heap_insert_into_heap_allocated ( duk_heap * heap,
duk_heaphdr * hdr )

Definition at line 32 of file duktape-1.5.2/src-separate/duk_heap_misc.c.

32 {
34
35#ifdef DUK_USE_DOUBLE_LINKED_HEAP
36 if (heap->heap_allocated) {
38 DUK_HEAPHDR_SET_PREV(heap, heap->heap_allocated, hdr);
39 }
40 DUK_HEAPHDR_SET_PREV(heap, hdr, NULL);
41#endif
42 DUK_HEAPHDR_SET_NEXT(heap, hdr, heap->heap_allocated);
43 heap->heap_allocated = hdr;
44}
#define DUK_HEAPHDR_GET_TYPE(h)
#define DUK_HEAPHDR_SET_NEXT(heap, h, val)
#define DUK_HEAPHDR_GET_PREV(heap, h)
#define DUK_HEAPHDR_SET_PREV(heap, h, val)
#define NULL
Definition gmacros.h:924

References DUK_ASSERT, DUK_HEAPHDR_GET_PREV, DUK_HEAPHDR_GET_TYPE, DUK_HEAPHDR_SET_NEXT, DUK_HEAPHDR_SET_PREV, DUK_HTYPE_STRING, duk_heap::heap_allocated, and NULL.

◆ duk_heap_remove_any_from_heap_allocated()

DUK_INTERNAL void duk_heap_remove_any_from_heap_allocated ( duk_heap * heap,
duk_heaphdr * hdr )

Definition at line 11 of file duktape-1.5.2/src-separate/duk_heap_misc.c.

11 {
13
14 if (DUK_HEAPHDR_GET_PREV(heap, hdr)) {
16 } else {
17 heap->heap_allocated = DUK_HEAPHDR_GET_NEXT(heap, hdr);
18 }
19 if (DUK_HEAPHDR_GET_NEXT(heap, hdr)) {
21 } else {
22 ;
23 }
24
25 /* The prev/next pointers of the removed duk_heaphdr are left as garbage.
26 * It's up to the caller to ensure they're written before inserting the
27 * object back.
28 */
29}
#define DUK_HEAPHDR_GET_NEXT(heap, h)

References DUK_ASSERT, DUK_HEAPHDR_GET_NEXT, DUK_HEAPHDR_GET_PREV, DUK_HEAPHDR_GET_TYPE, DUK_HEAPHDR_SET_NEXT, DUK_HEAPHDR_SET_PREV, DUK_HTYPE_STRING, and duk_heap::heap_allocated.