Skip to content

Commit

Permalink
README.md: remove dynamic allocation from the example
Browse files Browse the repository at this point in the history
  • Loading branch information
lukateras committed Jan 3, 2025
1 parent c82b2ce commit 4c4852f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ A tiny, secure, URL-friendly unique string ID generator for C.
#include <stdlib.h>

int main() {
char *id = calloc(NANOIDLEN + 1, 1);
char id[NANOIDLEN + 1] = "";

if (!id || nanoidgen(id, NANOIDLEN))
if (nanoidgen(id, NANOIDLEN))
return EXIT_FAILURE;

puts(id);
free(id);
}
```

Expand Down
5 changes: 2 additions & 3 deletions openbsd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ A tiny, secure, URL-friendly unique string ID generator for C.
#include <stdlib.h>

int main() {
char *id = calloc(NANOIDLEN + 1, 1);
char id[NANOIDLEN + 1] = "";

if (!id || nanoidgen(id, NANOIDLEN))
if (nanoidgen(id, NANOIDLEN))
return EXIT_FAILURE;

puts(id);
free(id);
}
```

Expand Down

0 comments on commit 4c4852f

Please sign in to comment.