Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardalee committed Mar 10, 2024
1 parent fa820c6 commit cb7e8cf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/C/src/distributed/HelloWorld.lf
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ 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.
char* buffer = malloc(length);

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

lf_set_array(message, buffer, length);

tag_t tag = lf_tag();
Expand Down

0 comments on commit cb7e8cf

Please sign in to comment.