Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/helper/test-genzeros.c # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / helper / test-genzeros.c` 37 lines ยท 729 bytes Raw Blame History 1 #define DISABLE_SIGN_COMPARE_WARNINGS 2 3 #include "test-tool.h" 4 #include "git-compat-util.h" 5 6 int cmd__genzeros(int argc, const char **argv) 7 { 8 /* static, so that it is NUL-initialized */ 9 static const char zeros[256 * 1024]; 10 intmax_t count; 11 ssize_t n; 12 13 if (argc > 2) { 14 fprintf(stderr, "usage: %s []\n", argv[0]); 15 return 1; 16 } 17 18 count = argc > 1 ? strtoimax(argv[1], NULL, 0) : -1; 19 20 /* Writing out individual NUL bytes is slow... */ 21 while (count < 0) 22 if (xwrite(1, zeros, ARRAY_SIZE(zeros)) < 0) 23 die_errno("write error"); 24 25 while (count > 0) { 26 n = xwrite(1, zeros, 27 count < ARRAY_SIZE(zeros) 28 ? count : ARRAY_SIZE(zeros)); 29 30 if (n < 0) 31 die_errno("write error"); 32 33 count -= n; 34 } 35 36 return 0; 37 }