diff --git a/README.md b/README.md index d0d4c1a..73d9de0 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,12 @@ A tiny, secure, URL-friendly unique string ID generator for C. #include 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); } ``` diff --git a/openbsd/README.md b/openbsd/README.md index e305371..2f4ce1e 100644 --- a/openbsd/README.md +++ b/openbsd/README.md @@ -16,13 +16,12 @@ A tiny, secure, URL-friendly unique string ID generator for C. #include 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); } ```