Skip to content

Commit

Permalink
Merge pull request NixOS#10723 from prednaz/embedding_the_nix_evaluat…
Browse files Browse the repository at this point in the history
…or_example

fix "Embedding the Nix Evaluator" c api example
  • Loading branch information
edolstra authored May 16, 2024
2 parents 02d393d + 4494045 commit ba2911b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/external-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Nix expression `builtins.nixVersion`.
// NOTE: This example lacks all error handling. Production code must check for
// errors, as some return values will be undefined.

void my_get_string_cb(const char * start, unsigned int n, char ** user_data)
void my_get_string_cb(const char * start, unsigned int n, void * user_data)
{
*user_data = strdup(start);
*((char **) user_data) = strdup(start);
}

int main()
Expand All @@ -63,7 +63,7 @@ int main()
nix_value_force(NULL, state, value);

char * version;
nix_get_string(NULL, value, my_get_string_cb, version);
nix_get_string(NULL, value, my_get_string_cb, &version);
printf("Nix version: %s\n", version);

free(version);
Expand Down

0 comments on commit ba2911b

Please sign in to comment.