Step one of trying to clean up the macro namespace
This commit is contained in:
parent
a5f5c30157
commit
0a9a3c7129
@ -1299,7 +1299,7 @@ static void module_sweep(KrkInstance * inst) {
|
||||
#ifndef KRK_STATIC_ONLY
|
||||
struct KrkModule * module = (struct KrkModule*)inst;
|
||||
if (module->libHandle) {
|
||||
dlClose(module->libHandle);
|
||||
krk_dlClose(module->libHandle);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
12
src/chunk.c
12
src/chunk.c
@ -21,8 +21,8 @@ static void addLine(KrkChunk * chunk, size_t line) {
|
||||
if (chunk->linesCount && chunk->lines[chunk->linesCount-1].line == line) return;
|
||||
if (chunk->linesCapacity < chunk->linesCount + 1) {
|
||||
int old = chunk->linesCapacity;
|
||||
chunk->linesCapacity = GROW_CAPACITY(old);
|
||||
chunk->lines = GROW_ARRAY(KrkLineMap, chunk->lines, old, chunk->linesCapacity);
|
||||
chunk->linesCapacity = KRK_GROW_CAPACITY(old);
|
||||
chunk->lines = KRK_GROW_ARRAY(KrkLineMap, chunk->lines, old, chunk->linesCapacity);
|
||||
}
|
||||
chunk->lines[chunk->linesCount] = (KrkLineMap){chunk->count, line};
|
||||
chunk->linesCount++;
|
||||
@ -31,8 +31,8 @@ static void addLine(KrkChunk * chunk, size_t line) {
|
||||
void krk_writeChunk(KrkChunk * chunk, uint8_t byte, size_t line) {
|
||||
if (chunk->capacity < chunk->count + 1) {
|
||||
int old = chunk->capacity;
|
||||
chunk->capacity = GROW_CAPACITY(old);
|
||||
chunk->code = GROW_ARRAY(uint8_t, chunk->code, old, chunk->capacity);
|
||||
chunk->capacity = KRK_GROW_CAPACITY(old);
|
||||
chunk->code = KRK_GROW_ARRAY(uint8_t, chunk->code, old, chunk->capacity);
|
||||
}
|
||||
|
||||
chunk->code[chunk->count] = byte;
|
||||
@ -41,8 +41,8 @@ void krk_writeChunk(KrkChunk * chunk, uint8_t byte, size_t line) {
|
||||
}
|
||||
|
||||
void krk_freeChunk(KrkChunk * chunk) {
|
||||
FREE_ARRAY(uint8_t, chunk->code, chunk->capacity);
|
||||
FREE_ARRAY(KrkLineMap, chunk->lines, chunk->linesCapacity);
|
||||
KRK_FREE_ARRAY(uint8_t, chunk->code, chunk->capacity);
|
||||
KRK_FREE_ARRAY(KrkLineMap, chunk->lines, chunk->linesCapacity);
|
||||
krk_freeValueArray(&chunk->constants);
|
||||
krk_initChunk(chunk);
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ static void initCompiler(struct GlobalState * state, Compiler * compiler, Functi
|
||||
compiler->codeobject = krk_newCodeObject();
|
||||
compiler->localCount = 0;
|
||||
compiler->localsSpace = 8;
|
||||
compiler->locals = GROW_ARRAY(Local,NULL,0,8);
|
||||
compiler->locals = KRK_GROW_ARRAY(Local,NULL,0,8);
|
||||
compiler->upvaluesSpace = 0;
|
||||
compiler->upvalues = NULL;
|
||||
compiler->breakCount = 0;
|
||||
@ -576,7 +576,7 @@ static KrkCodeObject * endCompiler(struct GlobalState * state) {
|
||||
function->localNames[i].deathday = currentChunk()->count;
|
||||
}
|
||||
}
|
||||
function->localNames = GROW_ARRAY(KrkLocalEntry, function->localNames,
|
||||
function->localNames = KRK_GROW_ARRAY(KrkLocalEntry, function->localNames,
|
||||
state->current->localNameCapacity, function->localNameCount); /* Shorten this down for runtime */
|
||||
|
||||
if (state->current->continueCount) { state->parser.previous = state->current->continues[0].token; error("continue without loop"); }
|
||||
@ -584,14 +584,14 @@ static KrkCodeObject * endCompiler(struct GlobalState * state) {
|
||||
emitReturn(state);
|
||||
|
||||
/* Reduce the size of dynamic arrays to their fixed sizes. */
|
||||
function->chunk.lines = GROW_ARRAY(KrkLineMap, function->chunk.lines,
|
||||
function->chunk.lines = KRK_GROW_ARRAY(KrkLineMap, function->chunk.lines,
|
||||
function->chunk.linesCapacity, function->chunk.linesCount);
|
||||
function->chunk.linesCapacity = function->chunk.linesCount;
|
||||
function->chunk.code = GROW_ARRAY(uint8_t, function->chunk.code,
|
||||
function->chunk.code = KRK_GROW_ARRAY(uint8_t, function->chunk.code,
|
||||
function->chunk.capacity, function->chunk.count);
|
||||
function->chunk.capacity = function->chunk.count;
|
||||
|
||||
function->expressions = GROW_ARRAY(KrkExpressionsMap, function->expressions,
|
||||
function->expressions = KRK_GROW_ARRAY(KrkExpressionsMap, function->expressions,
|
||||
function->expressionsCapacity, function->expressionsCount);
|
||||
function->expressionsCapacity = function->expressionsCount;
|
||||
|
||||
@ -648,10 +648,10 @@ static KrkCodeObject * endCompiler(struct GlobalState * state) {
|
||||
}
|
||||
|
||||
static void freeCompiler(Compiler * compiler) {
|
||||
FREE_ARRAY(Local,compiler->locals, compiler->localsSpace);
|
||||
FREE_ARRAY(Upvalue,compiler->upvalues, compiler->upvaluesSpace);
|
||||
FREE_ARRAY(struct LoopExit,compiler->breaks, compiler->breakSpace);
|
||||
FREE_ARRAY(struct LoopExit,compiler->continues, compiler->continueSpace);
|
||||
KRK_FREE_ARRAY(Local,compiler->locals, compiler->localsSpace);
|
||||
KRK_FREE_ARRAY(Upvalue,compiler->upvalues, compiler->upvaluesSpace);
|
||||
KRK_FREE_ARRAY(struct LoopExit,compiler->breaks, compiler->breakSpace);
|
||||
KRK_FREE_ARRAY(struct LoopExit,compiler->continues, compiler->continueSpace);
|
||||
|
||||
while (compiler->properties) {
|
||||
void * tmp = compiler->properties;
|
||||
@ -714,8 +714,8 @@ static ssize_t resolveLocal(struct GlobalState * state, Compiler * compiler, Krk
|
||||
static size_t renameLocal(struct GlobalState * state, size_t ind, KrkToken name) {
|
||||
if (state->current->codeobject->localNameCount + 1 > state->current->localNameCapacity) {
|
||||
size_t old = state->current->localNameCapacity;
|
||||
state->current->localNameCapacity = GROW_CAPACITY(old);
|
||||
state->current->codeobject->localNames = GROW_ARRAY(KrkLocalEntry, state->current->codeobject->localNames, old, state->current->localNameCapacity);
|
||||
state->current->localNameCapacity = KRK_GROW_CAPACITY(old);
|
||||
state->current->codeobject->localNames = KRK_GROW_ARRAY(KrkLocalEntry, state->current->codeobject->localNames, old, state->current->localNameCapacity);
|
||||
}
|
||||
state->current->codeobject->localNames[state->current->codeobject->localNameCount].id = ind;
|
||||
state->current->codeobject->localNames[state->current->codeobject->localNameCount].birthday = currentChunk()->count;
|
||||
@ -727,8 +727,8 @@ static size_t renameLocal(struct GlobalState * state, size_t ind, KrkToken name)
|
||||
static size_t addLocal(struct GlobalState * state, KrkToken name) {
|
||||
if (state->current->localCount + 1 > state->current->localsSpace) {
|
||||
size_t old = state->current->localsSpace;
|
||||
state->current->localsSpace = GROW_CAPACITY(old);
|
||||
state->current->locals = GROW_ARRAY(Local,state->current->locals,old,state->current->localsSpace);
|
||||
state->current->localsSpace = KRK_GROW_CAPACITY(old);
|
||||
state->current->locals = KRK_GROW_ARRAY(Local,state->current->locals,old,state->current->localsSpace);
|
||||
}
|
||||
size_t out = state->current->localCount;
|
||||
Local * local = &state->current->locals[state->current->localCount++];
|
||||
@ -1115,13 +1115,13 @@ static void attributeUnpack(struct GlobalState * state, int exprType) {
|
||||
startEatingWhitespace();
|
||||
size_t argCount = 0;
|
||||
size_t argSpace = 1;
|
||||
ssize_t * args = GROW_ARRAY(ssize_t,NULL,0,1);
|
||||
ssize_t * args = KRK_GROW_ARRAY(ssize_t,NULL,0,1);
|
||||
|
||||
do {
|
||||
if (argSpace < argCount + 1) {
|
||||
size_t old = argSpace;
|
||||
argSpace = GROW_CAPACITY(old);
|
||||
args = GROW_ARRAY(ssize_t,args,old,argSpace);
|
||||
argSpace = KRK_GROW_CAPACITY(old);
|
||||
args = KRK_GROW_ARRAY(ssize_t,args,old,argSpace);
|
||||
}
|
||||
consume(TOKEN_IDENTIFIER, "Expected attribute name");
|
||||
size_t ind = identifierConstant(state, &state->parser.previous);
|
||||
@ -1173,7 +1173,7 @@ static void attributeUnpack(struct GlobalState * state, int exprType) {
|
||||
}
|
||||
|
||||
_dotDone:
|
||||
FREE_ARRAY(ssize_t,args,argSpace);
|
||||
KRK_FREE_ARRAY(ssize_t,args,argSpace);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1253,13 +1253,13 @@ static void typeHintLocal(struct GlobalState * state) {
|
||||
static void letDeclaration(struct GlobalState * state) {
|
||||
size_t argCount = 0;
|
||||
size_t argSpace = 1;
|
||||
ssize_t * args = GROW_ARRAY(ssize_t,NULL,0,1);
|
||||
ssize_t * args = KRK_GROW_ARRAY(ssize_t,NULL,0,1);
|
||||
|
||||
do {
|
||||
if (argSpace < argCount + 1) {
|
||||
size_t old = argSpace;
|
||||
argSpace = GROW_CAPACITY(old);
|
||||
args = GROW_ARRAY(ssize_t,args,old,argSpace);
|
||||
argSpace = KRK_GROW_CAPACITY(old);
|
||||
args = KRK_GROW_ARRAY(ssize_t,args,old,argSpace);
|
||||
}
|
||||
ssize_t ind = parseVariable(state, "Expected variable name.");
|
||||
if (state->parser.hadError) goto _letDone;
|
||||
@ -1319,7 +1319,7 @@ static void letDeclaration(struct GlobalState * state) {
|
||||
}
|
||||
|
||||
_letDone:
|
||||
FREE_ARRAY(ssize_t,args,argSpace);
|
||||
KRK_FREE_ARRAY(ssize_t,args,argSpace);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2142,8 +2142,8 @@ static void patchBreaks(struct GlobalState * state, int loopStart) {
|
||||
static void breakStatement(struct GlobalState * state) {
|
||||
if (state->current->breakSpace < state->current->breakCount + 1) {
|
||||
size_t old = state->current->breakSpace;
|
||||
state->current->breakSpace = GROW_CAPACITY(old);
|
||||
state->current->breaks = GROW_ARRAY(struct LoopExit,state->current->breaks,old,state->current->breakSpace);
|
||||
state->current->breakSpace = KRK_GROW_CAPACITY(old);
|
||||
state->current->breaks = KRK_GROW_ARRAY(struct LoopExit,state->current->breaks,old,state->current->breakSpace);
|
||||
}
|
||||
|
||||
if (state->current->loopLocalCount != state->current->localCount) {
|
||||
@ -2156,8 +2156,8 @@ static void breakStatement(struct GlobalState * state) {
|
||||
static void continueStatement(struct GlobalState * state) {
|
||||
if (state->current->continueSpace < state->current->continueCount + 1) {
|
||||
size_t old = state->current->continueSpace;
|
||||
state->current->continueSpace = GROW_CAPACITY(old);
|
||||
state->current->continues = GROW_ARRAY(struct LoopExit,state->current->continues,old,state->current->continueSpace);
|
||||
state->current->continueSpace = KRK_GROW_CAPACITY(old);
|
||||
state->current->continues = KRK_GROW_ARRAY(struct LoopExit,state->current->continues,old,state->current->continueSpace);
|
||||
}
|
||||
|
||||
if (state->current->loopLocalCount != state->current->localCount) {
|
||||
@ -3054,8 +3054,8 @@ static size_t addUpvalue(struct GlobalState * state, Compiler * compiler, ssize_
|
||||
}
|
||||
if (upvalueCount + 1 > compiler->upvaluesSpace) {
|
||||
size_t old = compiler->upvaluesSpace;
|
||||
compiler->upvaluesSpace = GROW_CAPACITY(old);
|
||||
compiler->upvalues = GROW_ARRAY(Upvalue,compiler->upvalues,old,compiler->upvaluesSpace);
|
||||
compiler->upvaluesSpace = KRK_GROW_CAPACITY(old);
|
||||
compiler->upvalues = KRK_GROW_ARRAY(Upvalue,compiler->upvalues,old,compiler->upvaluesSpace);
|
||||
}
|
||||
compiler->upvalues[upvalueCount].isLocal = isLocal;
|
||||
compiler->upvalues[upvalueCount].index = index;
|
||||
|
@ -649,8 +649,8 @@ void krk_debug_addExpression(KrkCodeObject * codeobject, uint8_t start, uint8_t
|
||||
|
||||
if (codeobject->expressionsCapacity < codeobject->expressionsCount + 1) {
|
||||
size_t old = codeobject->expressionsCapacity;
|
||||
codeobject->expressionsCapacity = GROW_CAPACITY(old);
|
||||
codeobject->expressions = GROW_ARRAY(KrkExpressionsMap, codeobject->expressions, old, codeobject->expressionsCapacity);
|
||||
codeobject->expressionsCapacity = KRK_GROW_CAPACITY(old);
|
||||
codeobject->expressions = KRK_GROW_ARRAY(KrkExpressionsMap, codeobject->expressions, old, codeobject->expressionsCapacity);
|
||||
}
|
||||
|
||||
codeobject->expressions[codeobject->expressionsCount] = (KrkExpressionsMap){offset,start,midStart,midEnd,end};
|
||||
|
@ -1016,7 +1016,7 @@ _finishArgs:
|
||||
while (!exitRepl) {
|
||||
size_t lineCapacity = 8;
|
||||
size_t lineCount = 0;
|
||||
char ** lines = ALLOCATE(char *, lineCapacity);
|
||||
char ** lines = KRK_ALLOCATE(char *, lineCapacity);
|
||||
size_t totalData = 0;
|
||||
int valid = 1;
|
||||
char * allData = NULL;
|
||||
@ -1102,8 +1102,8 @@ _finishArgs:
|
||||
if (lineCapacity < lineCount + 1) {
|
||||
/* If we need more space, grow as needed... */
|
||||
size_t old = lineCapacity;
|
||||
lineCapacity = GROW_CAPACITY(old);
|
||||
lines = GROW_ARRAY(char *,lines,old,lineCapacity);
|
||||
lineCapacity = KRK_GROW_CAPACITY(old);
|
||||
lines = KRK_GROW_ARRAY(char *,lines,old,lineCapacity);
|
||||
}
|
||||
|
||||
int i = lineCount++;
|
||||
@ -1172,7 +1172,7 @@ _finishArgs:
|
||||
#endif
|
||||
free(lines[i]);
|
||||
}
|
||||
FREE_ARRAY(char *, lines, lineCapacity);
|
||||
KRK_FREE_ARRAY(char *, lines, lineCapacity);
|
||||
|
||||
if (valid) {
|
||||
KrkValue result = krk_interpret(allData, "<stdin>");
|
||||
|
@ -11,24 +11,24 @@
|
||||
typedef int64_t krk_integer_type;
|
||||
|
||||
#ifndef _WIN32
|
||||
# define PATH_SEP "/"
|
||||
# define KRK_PATH_SEP "/"
|
||||
# ifndef KRK_STATIC_ONLY
|
||||
# include <dlfcn.h>
|
||||
# define dlRefType void *
|
||||
# define dlSymType void *
|
||||
# define dlOpen(fileName) dlopen(fileName, RTLD_NOW)
|
||||
# define dlSym(dlRef, handlerName) dlsym(dlRef,handlerName)
|
||||
# define dlClose(dlRef) dlclose(dlRef)
|
||||
# define krk_dlRefType void *
|
||||
# define krk_dlSymType void *
|
||||
# define krk_dlOpen(fileName) dlopen(fileName, RTLD_NOW)
|
||||
# define krk_dlSym(dlRef, handlerName) dlsym(dlRef,handlerName)
|
||||
# define krk_dlClose(dlRef) dlclose(dlRef)
|
||||
# endif
|
||||
#else
|
||||
# include <windows.h>
|
||||
# define PATH_SEP "\\"
|
||||
# define KRK_PATH_SEP "\\"
|
||||
# ifndef KRK_STATIC_ONLY
|
||||
# define dlRefType HINSTANCE
|
||||
# define dlSymType FARPROC
|
||||
# define dlOpen(fileName) LoadLibraryA(fileName)
|
||||
# define dlSym(dlRef, handlerName) GetProcAddress(dlRef, handlerName)
|
||||
# define dlClose(dlRef)
|
||||
# define krk_dlRefType HINSTANCE
|
||||
# define krk_dlSymType FARPROC
|
||||
# define krk_dlOpen(fileName) LoadLibraryA(fileName)
|
||||
# define krk_dlSym(dlRef, handlerName) GetProcAddress(dlRef, handlerName)
|
||||
# define krk_dlClose(dlRef)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -7,13 +7,10 @@
|
||||
#include "object.h"
|
||||
#include "table.h"
|
||||
|
||||
#define GROW_CAPACITY(c) ((c) < 8 ? 8 : (c) * 2)
|
||||
#define GROW_ARRAY(t,p,o,n) (t*)krk_reallocate(p,sizeof(t)*o,sizeof(t)*n)
|
||||
|
||||
#define FREE_ARRAY(t,a,c) krk_reallocate(a,sizeof(t) * c, 0)
|
||||
#define FREE(t,p) krk_reallocate(p,sizeof(t),0)
|
||||
|
||||
#define ALLOCATE(type, count) (type*)krk_reallocate(NULL,0,sizeof(type)*(count))
|
||||
#define KRK_GROW_CAPACITY(c) ((c) < 8 ? 8 : (c) * 2)
|
||||
#define KRK_GROW_ARRAY(t,p,o,n) (t*)krk_reallocate(p,sizeof(t)*o,sizeof(t)*n)
|
||||
#define KRK_FREE_ARRAY(t,a,c) krk_reallocate(a,sizeof(t) * c, 0)
|
||||
#define KRK_ALLOCATE(type, count) (type*)krk_reallocate(NULL,0,sizeof(type)*(count))
|
||||
|
||||
/**
|
||||
* @brief Resize an allocated heap object.
|
||||
|
@ -375,7 +375,7 @@ struct DictValues {
|
||||
struct KrkModule {
|
||||
KrkInstance inst;
|
||||
#ifndef KRK_STATIC_ONLY
|
||||
dlRefType libHandle;
|
||||
krk_dlRefType libHandle;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <stdlib.h>
|
||||
#include "kuroko.h"
|
||||
#include "value.h"
|
||||
#include "threads.h"
|
||||
|
||||
/**
|
||||
* @brief One (key,value) pair in a table.
|
||||
|
@ -224,9 +224,9 @@ typedef struct KrkVM {
|
||||
#define KRK_GLOBAL_NO_DEFAULT_MODULES (1 << 14)
|
||||
|
||||
#ifndef KRK_DISABLE_THREADS
|
||||
# define threadLocal __thread
|
||||
# define krk_threadLocal __thread
|
||||
#else
|
||||
# define threadLocal
|
||||
# define krk_threadLocal
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -247,7 +247,7 @@ inline KrkThreadState * _macos_currentThread(void) {
|
||||
#elif !defined(KRK_DISABLE_THREADS) && ((defined(_WIN32) && !defined(KRKINLIB)) || defined(KRK_MEDIOCRE_TLS))
|
||||
#define krk_currentThread (*krk_getCurrentThread())
|
||||
#else
|
||||
extern threadLocal KrkThreadState krk_currentThread;
|
||||
extern krk_threadLocal KrkThreadState krk_currentThread;
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
34
src/memory.c
34
src/memory.c
@ -7,6 +7,8 @@
|
||||
|
||||
#include "private.h"
|
||||
|
||||
#define FREE_OBJECT(t,p) krk_reallocate(p,sizeof(t),0)
|
||||
|
||||
#if defined(KRK_EXTENSIVE_MEMORY_DEBUGGING)
|
||||
/**
|
||||
* Extensive Memory Debugging
|
||||
@ -18,7 +20,7 @@
|
||||
* the sizes of objects by both using the appropriate macros and by
|
||||
* ensuring the right sizes are passed to those macros. This is a very
|
||||
* easy thing to get wrong - allocate with @c malloc but free with the
|
||||
* @c FREE_ARRAY macros, for example, and the memory tracking now has
|
||||
* @c KRK_FREE_ARRAY macros, for example, and the memory tracking now has
|
||||
* a net negative, which may lead to underflowing. Use the right macros,
|
||||
* but mix up sizes between allocation and deallocation, and we may have
|
||||
* a "leak" of bytes and garbage collection may happen more often than
|
||||
@ -202,9 +204,9 @@ static void freeObject(KrkObj * object) {
|
||||
switch (object->type) {
|
||||
case KRK_OBJ_STRING: {
|
||||
KrkString * string = (KrkString*)object;
|
||||
FREE_ARRAY(char, string->chars, string->length + 1);
|
||||
KRK_FREE_ARRAY(char, string->chars, string->length + 1);
|
||||
if (string->codes && string->codes != string->chars) free(string->codes);
|
||||
FREE(KrkString, object);
|
||||
FREE_OBJECT(KrkString, object);
|
||||
break;
|
||||
}
|
||||
case KRK_OBJ_CODEOBJECT: {
|
||||
@ -212,25 +214,25 @@ static void freeObject(KrkObj * object) {
|
||||
krk_freeChunk(&function->chunk);
|
||||
krk_freeValueArray(&function->positionalArgNames);
|
||||
krk_freeValueArray(&function->keywordArgNames);
|
||||
FREE_ARRAY(KrkLocalEntry, function->localNames, function->localNameCount);
|
||||
FREE_ARRAY(KrkExpressionsMap, function->expressions, function->expressionsCapacity);
|
||||
KRK_FREE_ARRAY(KrkLocalEntry, function->localNames, function->localNameCount);
|
||||
KRK_FREE_ARRAY(KrkExpressionsMap, function->expressions, function->expressionsCapacity);
|
||||
function->localNameCount = 0;
|
||||
FREE(KrkCodeObject, object);
|
||||
FREE_OBJECT(KrkCodeObject, object);
|
||||
break;
|
||||
}
|
||||
case KRK_OBJ_NATIVE: {
|
||||
FREE(KrkNative, object);
|
||||
FREE_OBJECT(KrkNative, object);
|
||||
break;
|
||||
}
|
||||
case KRK_OBJ_CLOSURE: {
|
||||
KrkClosure * closure = (KrkClosure*)object;
|
||||
FREE_ARRAY(KrkUpvalue*,closure->upvalues,closure->upvalueCount);
|
||||
KRK_FREE_ARRAY(KrkUpvalue*,closure->upvalues,closure->upvalueCount);
|
||||
krk_freeTable(&closure->fields);
|
||||
FREE(KrkClosure, object);
|
||||
FREE_OBJECT(KrkClosure, object);
|
||||
break;
|
||||
}
|
||||
case KRK_OBJ_UPVALUE: {
|
||||
FREE(KrkUpvalue, object);
|
||||
FREE_OBJECT(KrkUpvalue, object);
|
||||
break;
|
||||
}
|
||||
case KRK_OBJ_CLASS: {
|
||||
@ -240,7 +242,7 @@ static void freeObject(KrkObj * object) {
|
||||
if (_class->base) {
|
||||
krk_tableDeleteExact(&_class->base->subclasses, OBJECT_VAL(object));
|
||||
}
|
||||
FREE(KrkClass, object);
|
||||
FREE_OBJECT(KrkClass, object);
|
||||
break;
|
||||
}
|
||||
case KRK_OBJ_INSTANCE: {
|
||||
@ -253,18 +255,18 @@ static void freeObject(KrkObj * object) {
|
||||
break;
|
||||
}
|
||||
case KRK_OBJ_BOUND_METHOD:
|
||||
FREE(KrkBoundMethod, object);
|
||||
FREE_OBJECT(KrkBoundMethod, object);
|
||||
break;
|
||||
case KRK_OBJ_TUPLE: {
|
||||
KrkTuple * tuple = (KrkTuple*)object;
|
||||
krk_freeValueArray(&tuple->values);
|
||||
FREE(KrkTuple, object);
|
||||
FREE_OBJECT(KrkTuple, object);
|
||||
break;
|
||||
}
|
||||
case KRK_OBJ_BYTES: {
|
||||
KrkBytes * bytes = (KrkBytes*)object;
|
||||
FREE_ARRAY(uint8_t, bytes->bytes, bytes->length);
|
||||
FREE(KrkBytes, bytes);
|
||||
KRK_FREE_ARRAY(uint8_t, bytes->bytes, bytes->length);
|
||||
FREE_OBJECT(KrkBytes, bytes);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -320,7 +322,7 @@ void krk_markObject(KrkObj * object) {
|
||||
object->flags |= KRK_OBJ_FLAGS_IS_MARKED;
|
||||
|
||||
if (vm.grayCapacity < vm.grayCount + 1) {
|
||||
vm.grayCapacity = GROW_CAPACITY(vm.grayCapacity);
|
||||
vm.grayCapacity = KRK_GROW_CAPACITY(vm.grayCapacity);
|
||||
vm.grayStack = realloc(vm.grayStack, sizeof(KrkObj*) * vm.grayCapacity);
|
||||
if (!vm.grayStack) exit(1);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ KrkValue krk_list_of(int argc, const KrkValue argv[], int hasKw) {
|
||||
|
||||
if (argc) {
|
||||
AS_LIST(outList)->capacity = argc;
|
||||
AS_LIST(outList)->values = GROW_ARRAY(KrkValue, AS_LIST(outList)->values, 0, argc);
|
||||
AS_LIST(outList)->values = KRK_GROW_ARRAY(KrkValue, AS_LIST(outList)->values, 0, argc);
|
||||
memcpy(AS_LIST(outList)->values, argv, sizeof(KrkValue) * argc);
|
||||
AS_LIST(outList)->count = argc;
|
||||
}
|
||||
@ -162,8 +162,8 @@ static int _list_extend_callback(void * context, const KrkValue * values, size_t
|
||||
KrkValueArray * positionals = context;
|
||||
if (positionals->count + count > positionals->capacity) {
|
||||
size_t old = positionals->capacity;
|
||||
positionals->capacity = (count == 1) ? GROW_CAPACITY(old) : (positionals->count + count);
|
||||
positionals->values = GROW_ARRAY(KrkValue, positionals->values, old, positionals->capacity);
|
||||
positionals->capacity = (count == 1) ? KRK_GROW_CAPACITY(old) : (positionals->count + count);
|
||||
positionals->values = KRK_GROW_ARRAY(KrkValue, positionals->values, old, positionals->capacity);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
|
@ -56,7 +56,7 @@ KRK_Method(str,__add__) {
|
||||
bl = them->length;
|
||||
|
||||
size_t length = al + bl;
|
||||
char * chars = ALLOCATE(char, length + 1);
|
||||
char * chars = KRK_ALLOCATE(char, length + 1);
|
||||
memcpy(chars, a, al);
|
||||
memcpy(chars + al, b, bl);
|
||||
chars[length] = '\0';
|
||||
@ -1080,8 +1080,8 @@ _corrupt:
|
||||
void krk_pushStringBuilder(struct StringBuilder * sb, char c) {
|
||||
if (sb->capacity < sb->length + 1) {
|
||||
size_t old = sb->capacity;
|
||||
sb->capacity = GROW_CAPACITY(old);
|
||||
sb->bytes = GROW_ARRAY(char, sb->bytes, old, sb->capacity);
|
||||
sb->capacity = KRK_GROW_CAPACITY(old);
|
||||
sb->bytes = KRK_GROW_ARRAY(char, sb->bytes, old, sb->capacity);
|
||||
}
|
||||
sb->bytes[sb->length++] = c;
|
||||
}
|
||||
@ -1091,9 +1091,9 @@ void krk_pushStringBuilderStr(struct StringBuilder * sb, const char *str, size_t
|
||||
size_t prevcap = sb->capacity;
|
||||
while (sb->capacity < sb->length + len) {
|
||||
size_t old = sb->capacity;
|
||||
sb->capacity = GROW_CAPACITY(old);
|
||||
sb->capacity = KRK_GROW_CAPACITY(old);
|
||||
}
|
||||
sb->bytes = GROW_ARRAY(char, sb->bytes, prevcap, sb->capacity);
|
||||
sb->bytes = KRK_GROW_ARRAY(char, sb->bytes, prevcap, sb->capacity);
|
||||
}
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
sb->bytes[sb->length++] = *(str++);
|
||||
@ -1101,7 +1101,7 @@ void krk_pushStringBuilderStr(struct StringBuilder * sb, const char *str, size_t
|
||||
}
|
||||
|
||||
static void _freeStringBuilder(struct StringBuilder * sb) {
|
||||
FREE_ARRAY(char,sb->bytes, sb->capacity);
|
||||
KRK_FREE_ARRAY(char,sb->bytes, sb->capacity);
|
||||
sb->bytes = NULL;
|
||||
sb->length = 0;
|
||||
sb->capacity = 0;
|
||||
|
@ -13,8 +13,8 @@ static int _tuple_init_callback(void * context, const KrkValue * values, size_t
|
||||
KrkValueArray * positionals = context;
|
||||
if (positionals->count + count > positionals->capacity) {
|
||||
size_t old = positionals->capacity;
|
||||
positionals->capacity = (count == 1) ? GROW_CAPACITY(old) : (positionals->count + count);
|
||||
positionals->values = GROW_ARRAY(KrkValue, positionals->values, old, positionals->capacity);
|
||||
positionals->capacity = (count == 1) ? KRK_GROW_CAPACITY(old) : (positionals->count + count);
|
||||
positionals->values = KRK_GROW_ARRAY(KrkValue, positionals->values, old, positionals->capacity);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
|
13
src/object.c
13
src/object.c
@ -7,6 +7,7 @@
|
||||
#include <kuroko/value.h>
|
||||
#include <kuroko/vm.h>
|
||||
#include <kuroko/table.h>
|
||||
#include <kuroko/threads.h>
|
||||
|
||||
#include "private.h"
|
||||
|
||||
@ -207,7 +208,7 @@ KrkString * krk_takeString(char * chars, size_t length) {
|
||||
_obtain_lock(_stringLock);
|
||||
KrkString * interned = krk_tableFindString(&vm.strings, chars, length, hash);
|
||||
if (interned != NULL) {
|
||||
free(chars); /* This string isn't owned by us yet, so free, not FREE_ARRAY */
|
||||
free(chars); /* This string isn't owned by us yet, so free, not KRK_FREE_ARRAY */
|
||||
_release_lock(_stringLock);
|
||||
return interned;
|
||||
}
|
||||
@ -226,7 +227,7 @@ KrkString * krk_copyString(const char * chars, size_t length) {
|
||||
_release_lock(_stringLock);
|
||||
return interned;
|
||||
}
|
||||
char * heapChars = ALLOCATE(char, length + 1);
|
||||
char * heapChars = KRK_ALLOCATE(char, length + 1);
|
||||
memcpy(heapChars, chars ? chars : "", length);
|
||||
heapChars[length] = '\0';
|
||||
KrkString * result = allocateString(heapChars, length, hash);
|
||||
@ -239,7 +240,7 @@ KrkString * krk_takeStringVetted(char * chars, size_t length, size_t codesLength
|
||||
_obtain_lock(_stringLock);
|
||||
KrkString * interned = krk_tableFindString(&vm.strings, chars, length, hash);
|
||||
if (interned != NULL) {
|
||||
FREE_ARRAY(char, chars, length + 1);
|
||||
KRK_FREE_ARRAY(char, chars, length + 1);
|
||||
_release_lock(_stringLock);
|
||||
return interned;
|
||||
}
|
||||
@ -284,7 +285,7 @@ KrkNative * krk_newNative(NativeFn function, const char * name, int type) {
|
||||
}
|
||||
|
||||
KrkClosure * krk_newClosure(KrkCodeObject * function, KrkValue globals) {
|
||||
KrkUpvalue ** upvalues = ALLOCATE(KrkUpvalue*, function->upvalueCount);
|
||||
KrkUpvalue ** upvalues = KRK_ALLOCATE(KrkUpvalue*, function->upvalueCount);
|
||||
for (size_t i = 0; i < function->upvalueCount; ++i) {
|
||||
upvalues[i] = NULL;
|
||||
}
|
||||
@ -355,7 +356,7 @@ KrkTuple * krk_newTuple(size_t length) {
|
||||
krk_initValueArray(&tuple->values);
|
||||
krk_push(OBJECT_VAL(tuple));
|
||||
tuple->values.capacity = length;
|
||||
tuple->values.values = GROW_ARRAY(KrkValue,NULL,0,length);
|
||||
tuple->values.values = KRK_GROW_ARRAY(KrkValue,NULL,0,length);
|
||||
krk_pop();
|
||||
return tuple;
|
||||
}
|
||||
@ -365,7 +366,7 @@ KrkBytes * krk_newBytes(size_t length, uint8_t * source) {
|
||||
bytes->length = length;
|
||||
bytes->bytes = NULL;
|
||||
krk_push(OBJECT_VAL(bytes));
|
||||
bytes->bytes = ALLOCATE(uint8_t, length);
|
||||
bytes->bytes = KRK_ALLOCATE(uint8_t, length);
|
||||
bytes->obj.hash = -1;
|
||||
if (source) {
|
||||
memcpy(bytes->bytes, source, length);
|
||||
|
@ -272,7 +272,7 @@ void krk_module_init_kuroko(void) {
|
||||
KRK_DOC(BIND_FUNC(vm.system,get_recursion_depth),
|
||||
"Examine the maximum recursion depth of the current thread.");
|
||||
krk_attachNamedObject(&vm.system->fields, "module", (KrkObj*)vm.baseClasses->moduleClass);
|
||||
krk_attachNamedObject(&vm.system->fields, "path_sep", (KrkObj*)S(PATH_SEP));
|
||||
krk_attachNamedObject(&vm.system->fields, "path_sep", (KrkObj*)S(KRK_PATH_SEP));
|
||||
KrkValue module_paths = krk_list_of(0,NULL,0);
|
||||
krk_attachNamedValue(&vm.system->fields, "module_paths", module_paths);
|
||||
krk_writeValueArray(AS_LIST(module_paths), OBJECT_VAL(S("./")));
|
||||
|
@ -18,7 +18,7 @@ void krk_initTable(KrkTable * table) {
|
||||
}
|
||||
|
||||
void krk_freeTable(KrkTable * table) {
|
||||
FREE_ARRAY(KrkTableEntry, table->entries, table->capacity);
|
||||
KRK_FREE_ARRAY(KrkTableEntry, table->entries, table->capacity);
|
||||
krk_initTable(table);
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ void krk_tableAdjustCapacity(KrkTable * table, size_t capacity) {
|
||||
capacity = (1UL << powerOfTwoCapacity);
|
||||
}
|
||||
|
||||
KrkTableEntry * entries = ALLOCATE(KrkTableEntry, capacity);
|
||||
KrkTableEntry * entries = KRK_ALLOCATE(KrkTableEntry, capacity);
|
||||
for (size_t i = 0; i < capacity; ++i) {
|
||||
entries[i].key = KWARGS_VAL(0);
|
||||
entries[i].value = KWARGS_VAL(0);
|
||||
@ -137,14 +137,14 @@ void krk_tableAdjustCapacity(KrkTable * table, size_t capacity) {
|
||||
table->count++;
|
||||
}
|
||||
|
||||
FREE_ARRAY(KrkTableEntry, table->entries, table->capacity);
|
||||
KRK_FREE_ARRAY(KrkTableEntry, table->entries, table->capacity);
|
||||
table->entries = entries;
|
||||
table->capacity = capacity;
|
||||
}
|
||||
|
||||
int krk_tableSet(KrkTable * table, KrkValue key, KrkValue value) {
|
||||
if (table->count + 1 > table->capacity * TABLE_MAX_LOAD) {
|
||||
size_t capacity = GROW_CAPACITY(table->capacity);
|
||||
size_t capacity = KRK_GROW_CAPACITY(table->capacity);
|
||||
krk_tableAdjustCapacity(table, capacity);
|
||||
}
|
||||
KrkTableEntry * entry = krk_findEntry(table->entries, table->capacity, key);
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#ifndef KRK_DISABLE_THREADS
|
||||
#include <kuroko/util.h>
|
||||
#include <kuroko/threads.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
@ -106,7 +107,7 @@ static void * _startthread(void * _threadObj) {
|
||||
}
|
||||
_release_lock(_threadLock);
|
||||
|
||||
FREE_ARRAY(size_t, krk_currentThread.stack, krk_currentThread.stackSize);
|
||||
KRK_FREE_ARRAY(size_t, krk_currentThread.stack, krk_currentThread.stackSize);
|
||||
free(krk_currentThread.frames);
|
||||
|
||||
return NULL;
|
||||
|
@ -17,8 +17,8 @@ void krk_initValueArray(KrkValueArray * array) {
|
||||
void krk_writeValueArray(KrkValueArray * array, KrkValue value) {
|
||||
if (array->capacity < array->count + 1) {
|
||||
int old = array->capacity;
|
||||
array->capacity = GROW_CAPACITY(old);
|
||||
array->values = GROW_ARRAY(KrkValue, array->values, old, array->capacity);
|
||||
array->capacity = KRK_GROW_CAPACITY(old);
|
||||
array->values = KRK_GROW_ARRAY(KrkValue, array->values, old, array->capacity);
|
||||
}
|
||||
|
||||
array->values[array->count] = value;
|
||||
@ -26,7 +26,7 @@ void krk_writeValueArray(KrkValueArray * array, KrkValue value) {
|
||||
}
|
||||
|
||||
void krk_freeValueArray(KrkValueArray * array) {
|
||||
FREE_ARRAY(KrkValue, array->values, array->capacity);
|
||||
KRK_FREE_ARRAY(KrkValue, array->values, array->capacity);
|
||||
krk_initValueArray(array);
|
||||
}
|
||||
|
||||
|
32
src/vm.c
32
src/vm.c
@ -133,14 +133,14 @@ void krk_resetStack(void) {
|
||||
void krk_growStack(void) {
|
||||
size_t old = krk_currentThread.stackSize;
|
||||
size_t old_offset = krk_currentThread.stackTop - krk_currentThread.stack;
|
||||
size_t newsize = GROW_CAPACITY(old);
|
||||
size_t newsize = KRK_GROW_CAPACITY(old);
|
||||
if (krk_currentThread.flags & KRK_THREAD_DEFER_STACK_FREE) {
|
||||
KrkValue * newStack = GROW_ARRAY(KrkValue, NULL, 0, newsize);
|
||||
KrkValue * newStack = KRK_GROW_ARRAY(KrkValue, NULL, 0, newsize);
|
||||
memcpy(newStack, krk_currentThread.stack, sizeof(KrkValue) * old);
|
||||
krk_currentThread.stack = newStack;
|
||||
krk_currentThread.flags &= ~(KRK_THREAD_DEFER_STACK_FREE);
|
||||
} else {
|
||||
krk_currentThread.stack = GROW_ARRAY(KrkValue, krk_currentThread.stack, old, newsize);
|
||||
krk_currentThread.stack = KRK_GROW_ARRAY(KrkValue, krk_currentThread.stack, old, newsize);
|
||||
}
|
||||
krk_currentThread.stackSize = newsize;
|
||||
krk_currentThread.stackTop = krk_currentThread.stack + old_offset;
|
||||
@ -368,8 +368,8 @@ static int _unpack_args(void * context, const KrkValue * values, size_t count) {
|
||||
KrkValueArray * positionals = context;
|
||||
if (positionals->count + count > positionals->capacity) {
|
||||
size_t old = positionals->capacity;
|
||||
positionals->capacity = (count == 1) ? GROW_CAPACITY(old) : (positionals->count + count);
|
||||
positionals->values = GROW_ARRAY(KrkValue, positionals->values, old, positionals->capacity);
|
||||
positionals->capacity = (count == 1) ? KRK_GROW_CAPACITY(old) : (positionals->count + count);
|
||||
positionals->values = KRK_GROW_ARRAY(KrkValue, positionals->values, old, positionals->capacity);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
@ -654,7 +654,7 @@ inline KrkValue krk_callNativeOnStack(size_t argCount, const KrkValue *stackArgs
|
||||
KrkValue result = native(argCount, stackArgs, hasKw);
|
||||
|
||||
if (unlikely(krk_currentThread.stack != stackBefore)) {
|
||||
FREE_ARRAY(KrkValue, stackBefore, sizeBefore);
|
||||
KRK_FREE_ARRAY(KrkValue, stackBefore, sizeBefore);
|
||||
}
|
||||
|
||||
krk_currentThread.flags &= ~(KRK_THREAD_DEFER_STACK_FREE);
|
||||
@ -1004,11 +1004,11 @@ void krk_freeVM(void) {
|
||||
while (krk_currentThread.next) {
|
||||
KrkThreadState * thread = krk_currentThread.next;
|
||||
krk_currentThread.next = thread->next;
|
||||
FREE_ARRAY(size_t, thread->stack, thread->stackSize);
|
||||
KRK_FREE_ARRAY(size_t, thread->stack, thread->stackSize);
|
||||
free(thread->frames);
|
||||
}
|
||||
|
||||
FREE_ARRAY(size_t, krk_currentThread.stack, krk_currentThread.stackSize);
|
||||
KRK_FREE_ARRAY(size_t, krk_currentThread.stack, krk_currentThread.stackSize);
|
||||
memset(&krk_vm,0,sizeof(krk_vm));
|
||||
free(krk_currentThread.frames);
|
||||
memset(&krk_currentThread,0,sizeof(KrkThreadState));
|
||||
@ -1233,7 +1233,7 @@ int krk_loadModule(KrkString * path, KrkValue * moduleOut, KrkString * runAs, Kr
|
||||
/* Try .../path/__init__.krk */
|
||||
krk_push(OBJECT_VAL(path));
|
||||
krk_addObjects();
|
||||
krk_push(OBJECT_VAL(S(PATH_SEP "__init__.krk")));
|
||||
krk_push(OBJECT_VAL(S(KRK_PATH_SEP "__init__.krk")));
|
||||
krk_addObjects();
|
||||
fileName = AS_CSTRING(krk_peek(0));
|
||||
if (stat(fileName,&statbuf) == 0) {
|
||||
@ -1243,7 +1243,7 @@ int krk_loadModule(KrkString * path, KrkValue * moduleOut, KrkString * runAs, Kr
|
||||
|
||||
/* Convert back to .-formatted */
|
||||
krk_push(krk_valueGetAttribute(OBJECT_VAL(path), "replace"));
|
||||
krk_push(OBJECT_VAL(S(PATH_SEP)));
|
||||
krk_push(OBJECT_VAL(S(KRK_PATH_SEP)));
|
||||
krk_push(OBJECT_VAL(S(".")));
|
||||
krk_push(krk_callStack(2));
|
||||
KrkValue packageName = krk_peek(0);
|
||||
@ -1337,7 +1337,7 @@ int krk_loadModule(KrkString * path, KrkValue * moduleOut, KrkString * runAs, Kr
|
||||
#ifndef KRK_STATIC_ONLY
|
||||
_sharedObject: (void)0;
|
||||
|
||||
dlRefType dlRef = dlOpen(fileName);
|
||||
krk_dlRefType dlRef = krk_dlOpen(fileName);
|
||||
if (!dlRef) {
|
||||
*moduleOut = NONE_VAL();
|
||||
krk_runtimeError(vm.exceptions->importError,
|
||||
@ -1357,11 +1357,11 @@ int krk_loadModule(KrkString * path, KrkValue * moduleOut, KrkString * runAs, Kr
|
||||
char * handlerName = AS_CSTRING(krk_peek(0));
|
||||
|
||||
KrkValue (*moduleOnLoad)(KrkString * name);
|
||||
dlSymType out = dlSym(dlRef, handlerName);
|
||||
krk_dlSymType out = krk_dlSym(dlRef, handlerName);
|
||||
memcpy(&moduleOnLoad,&out,sizeof(out));
|
||||
|
||||
if (!moduleOnLoad) {
|
||||
dlClose(dlRef);
|
||||
krk_dlClose(dlRef);
|
||||
*moduleOut = NONE_VAL();
|
||||
krk_runtimeError(vm.exceptions->importError,
|
||||
"Failed to run module initialization method '%s' from shared object '%s'",
|
||||
@ -1373,7 +1373,7 @@ int krk_loadModule(KrkString * path, KrkValue * moduleOut, KrkString * runAs, Kr
|
||||
|
||||
*moduleOut = moduleOnLoad(runAs);
|
||||
if (!krk_isInstanceOf(*moduleOut, vm.baseClasses->moduleClass)) {
|
||||
dlClose(dlRef);
|
||||
krk_dlClose(dlRef);
|
||||
krk_runtimeError(vm.exceptions->importError,
|
||||
"Failed to load module '%S' from '%s'", runAs, fileName);
|
||||
return 0;
|
||||
@ -1403,7 +1403,7 @@ int krk_loadModule(KrkString * path, KrkValue * moduleOut, KrkString * runAs, Kr
|
||||
if (runAs == S("__main__")) {
|
||||
/* Then let's use 'path' instead, and replace all the /'s with .'s... */
|
||||
krk_push(krk_valueGetAttribute(OBJECT_VAL(path), "replace"));
|
||||
krk_push(OBJECT_VAL(S(PATH_SEP)));
|
||||
krk_push(OBJECT_VAL(S(KRK_PATH_SEP)));
|
||||
krk_push(OBJECT_VAL(S(".")));
|
||||
krk_push(krk_callStack(2));
|
||||
} else {
|
||||
@ -1597,7 +1597,7 @@ int krk_importModule(KrkString * name, KrkString * runAs) {
|
||||
krk_currentThread.stack[argBase-1] = krk_pop();
|
||||
/* Now concatenate forward slash... */
|
||||
krk_push(krk_currentThread.stack[argBase+1]); /* Slash path */
|
||||
krk_push(OBJECT_VAL(S(PATH_SEP)));
|
||||
krk_push(OBJECT_VAL(S(KRK_PATH_SEP)));
|
||||
krk_addObjects();
|
||||
krk_currentThread.stack[argBase+1] = krk_pop();
|
||||
/* And now for the dot... */
|
||||
|
@ -15,7 +15,7 @@ static int runSimpleRepl(void) {
|
||||
while (!exitRepl) {
|
||||
size_t lineCapacity = 8;
|
||||
size_t lineCount = 0;
|
||||
char ** lines = ALLOCATE(char *, lineCapacity);
|
||||
char ** lines = KRK_ALLOCATE(char *, lineCapacity);
|
||||
size_t totalData = 0;
|
||||
int valid = 1;
|
||||
char * allData = NULL;
|
||||
@ -80,8 +80,8 @@ static int runSimpleRepl(void) {
|
||||
if (lineCapacity < lineCount + 1) {
|
||||
/* If we need more space, grow as needed... */
|
||||
size_t old = lineCapacity;
|
||||
lineCapacity = GROW_CAPACITY(old);
|
||||
lines = GROW_ARRAY(char *,lines,old,lineCapacity);
|
||||
lineCapacity = KRK_GROW_CAPACITY(old);
|
||||
lines = KRK_GROW_ARRAY(char *,lines,old,lineCapacity);
|
||||
}
|
||||
|
||||
int i = lineCount++;
|
||||
@ -149,7 +149,7 @@ static int runSimpleRepl(void) {
|
||||
#endif
|
||||
free(lines[i]);
|
||||
}
|
||||
FREE_ARRAY(char *, lines, lineCapacity);
|
||||
KRK_FREE_ARRAY(char *, lines, lineCapacity);
|
||||
if (valid) {
|
||||
KrkValue result = krk_interpret(allData, "<stdin>");
|
||||
if (!IS_NONE(result)) {
|
||||
|
Loading…
Reference in New Issue
Block a user