Skip to content

Commit

Permalink
Fix compile problems appearing with the updated release
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardalee committed Mar 10, 2024
1 parent f36a2c4 commit fa820c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 0 additions & 4 deletions examples/C/src/ReflexGame/ReflexGame.lf
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ target C {
keepalive: true
}

preamble {=
#include "include/core/platform.h"
=}

/**
* Produce a counting sequence at random times with a minimum and maximum time between outputs
* specified as parameters.
Expand Down
8 changes: 6 additions & 2 deletions examples/C/src/distributed/HelloWorld.lf
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ reactor MessageGenerator(prefix: string = "") {
// With NULL, 0 arguments, snprintf tells us how many bytes are needed.
// Add one for the null terminator.
int length = snprintf(NULL, 0, "%s %d", self->prefix, self->count) + 1;

// Dynamically allocate memory for the output.
SET_NEW_ARRAY(message, length);
char* buffer = malloc(length);

// Populate the output string and increment the count.
snprintf(message->value, length, "%s %d", self->prefix, self->count++);
snprintf(buffer, length, "%s %d", self->prefix, self->count++);

lf_set_array(message, buffer, length);

tag_t tag = lf_tag();
lf_print("At (elapsed) logical tag (%lld, %u), source sends message: %s",
Expand Down

0 comments on commit fa820c6

Please sign in to comment.