Author | Jamozed <[email protected]> |
Date | 2020-07-02 03:04:21 |
Commit | f5515d97d04d53ed70e903fcf58bceb9e013929f |
Parent | f1a3ef488dc66fefa018f87beb5e6b6027e9cadd |
crc32: Move buffer onto stack
Diffstat
M | src/crc32.c | | | 9 | +++++---- |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/crc32.c b/src/crc32.c index 5710107..0b34a1c 100644 --- a/src/crc32.c +++ b/src/crc32.c @@ -1,4 +1,4 @@ -// crc32.c, version 1.0.0 +// crc32.c, version 1.0.1 // OMKOV coreutils crc32 // Copyright (C) 2020, Jakob Wakeling // All rights reserved. @@ -42,7 +42,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. #include <stdio.h> #include <string.h> -static char stdbuf[BUFSIZ * 16]; +#define VERSION "1.0.1" static const uint32_t CRC32[] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, @@ -120,7 +120,8 @@ int main(int argc, char *argv[]) { } static inline int crc32(const char *file) { - FILE *fi; register size_t fl = 0; register uint32_t crc = ~0; + char stdbuf[BUFSIZ * 16]; FILE *fi; + register size_t fl = 0; register uint32_t crc = ~0; if (!file || (file[0] == '-' && file[1] == 0)) { fi = stdin; } else if (!(fi = fopen(file, "r"))) { return 1; } @@ -147,7 +148,7 @@ static void help(void) { } static void version() { - puts("OMKOV coreutils crc32, version 1.0.0"); + puts("OMKOV coreutils crc32, version " VERSION); puts("Copyright (C) 2020, Jakob Wakeling"); puts("All rights reserved."); puts("OMKOV Permissive Licence (https://www.omkov.net/OLPE)");