MCPcopy Create free account
hub / github.com/crownengine/crown / new_expr

Function new_expr

3rdparty/tinyexpr/tinyexpr.c:87–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85#define CHECK_NULL(ptr, ...) if ((ptr) == NULL) { __VA_ARGS__; return NULL; }
86
87static te_expr *new_expr(const int type, const te_expr *parameters[]) {
88 const int arity = ARITY(type);
89 const int psize = sizeof(void*) * arity;
90 const int size = (sizeof(te_expr) - sizeof(void*)) + psize + (IS_CLOSURE(type) ? sizeof(void*) : 0);
91 te_expr *ret = malloc(size);
92 CHECK_NULL(ret);
93
94 memset(ret, 0, size);
95 if (arity && parameters) {
96 memcpy(ret->parameters, parameters, psize);
97 }
98 ret->type = type;
99 ret->bound = 0;
100 return ret;
101}
102
103
104void te_free_parameters(te_expr *n) {

Callers 1

baseFunction · 0.85

Calls 3

memsetFunction · 0.85
memcpyFunction · 0.85
mallocFunction · 0.50

Tested by

no test coverage detected