Skip to content

Commit

Permalink
Merge branch 'Voxellius:main' into patch-4
Browse files Browse the repository at this point in the history
  • Loading branch information
SpcFORK authored Jun 29, 2024
2 parents b45f18a + c8640dc commit c23970d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions dist/libvoxel.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ typedef enum {
typedef struct voxel_Context {
voxel_Bool isInitialised;
char* code;
voxel_Count codeLength;
voxel_Count codeSize;
voxel_Builtin* builtins;
voxel_Count builtinCount;
struct voxel_Scope* globalScope;
Expand Down Expand Up @@ -2212,7 +2212,7 @@ voxel_Context* voxel_newContext() {

context->isInitialised = VOXEL_FALSE;
context->code = VOXEL_NULL;
context->codeLength = 0;
context->codeSize = 0;
context->builtins = (voxel_Builtin*)VOXEL_MALLOC(0); VOXEL_TAG_MALLOC_SIZE("voxel_Context->builtins", 0);
context->builtinCount = 0;
context->firstTrackedThing = VOXEL_NULL;
Expand All @@ -2238,7 +2238,7 @@ VOXEL_ERRORABLE voxel_initContext(voxel_Context* context) {
}

#ifdef VOXEL_MAGIC
if (context->codeLength < VOXEL_MAGIC_SIZE) {
if (context->codeSize < VOXEL_MAGIC_SIZE) {
VOXEL_THROW(VOXEL_ERROR_INVALID_MAGIC);
}

Expand Down Expand Up @@ -4285,7 +4285,7 @@ VOXEL_ERRORABLE voxel_greaterThanOperation(voxel_Context* context, voxel_Thing*
// src/parser.h

VOXEL_ERRORABLE voxel_safeToRead(voxel_Context* context, voxel_Position* position, voxel_Count bytesToRead) {
if ((*position) + bytesToRead > context->codeLength) {
if ((*position) + bytesToRead > context->codeSize) {
VOXEL_THROW(VOXEL_ERROR_TOKENISATION_END);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/hello.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ int main(int argc, char* argv[]) {
voxel_defineBuiltin(context, "add", &builtin_add);

context->code = code;
context->codeLength = 1024;
context->codeSize = 1024;

VOXEL_MUST_CODE(voxel_initContext(context));

Expand Down
2 changes: 1 addition & 1 deletion runtime/voxel.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main(int argc, char* argv[]) {
}

context->code = data;
context->codeLength = size;
context->codeSize = size;

VOXEL_MUST_CODE(voxel_initContext(context));

Expand Down
4 changes: 2 additions & 2 deletions src/contexts.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ voxel_Context* voxel_newContext() {

context->isInitialised = VOXEL_FALSE;
context->code = VOXEL_NULL;
context->codeLength = 0;
context->codeSize = 0;
context->builtins = (voxel_Builtin*)VOXEL_MALLOC(0); VOXEL_TAG_MALLOC_SIZE("voxel_Context->builtins", 0);
context->builtinCount = 0;
context->firstTrackedThing = VOXEL_NULL;
Expand All @@ -29,7 +29,7 @@ VOXEL_ERRORABLE voxel_initContext(voxel_Context* context) {
}

#ifdef VOXEL_MAGIC
if (context->codeLength < VOXEL_MAGIC_SIZE) {
if (context->codeSize < VOXEL_MAGIC_SIZE) {
VOXEL_THROW(VOXEL_ERROR_INVALID_MAGIC);
}

Expand Down
2 changes: 1 addition & 1 deletion src/declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ typedef enum {
typedef struct voxel_Context {
voxel_Bool isInitialised;
char* code;
voxel_Count codeLength;
voxel_Count codeSize;
voxel_Builtin* builtins;
voxel_Count builtinCount;
struct voxel_Scope* globalScope;
Expand Down
2 changes: 1 addition & 1 deletion src/parser.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VOXEL_ERRORABLE voxel_safeToRead(voxel_Context* context, voxel_Position* position, voxel_Count bytesToRead) {
if ((*position) + bytesToRead > context->codeLength) {
if ((*position) + bytesToRead > context->codeSize) {
VOXEL_THROW(VOXEL_ERROR_TOKENISATION_END);
}

Expand Down

0 comments on commit c23970d

Please sign in to comment.