Advent of Code

Check-in [b4c322283a]
Login

Check-in [b4c322283a]

Overview
Comment:comment about 13/8
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b4c322283a05712feba5f5ea5b7afcb4aa3e5f12f1cfd20cc8ac98046c84f501
User & Date: nnz on 2024-12-03 15:21:45.826
Other Links: manifest | tags
Context
2024-12-03
16:48
added versionable fossil settings check-in: 095436466b user: nnz tags: trunk
15:21
comment about 13/8 check-in: b4c322283a user: nnz tags: trunk
14:56
comment inside command check-in: e5bb3b830c user: nnz tags: trunk
Changes
37
38
39
40
41
42
43
44

45
46
47
48
49
50
51
37
38
39
40
41
42
43

44
45
46
47
48
49
50
51







-
+







    int ch;
    char *tmp = malloc(512);
    size_t s = 512;
    size_t r = 0;
    while ((ch = fgetc(h)) != EOF) {
        if (r == s) {
            //grow tmp
            char *ttmp = realloc(tmp, (13*s)/8);
            char *ttmp = realloc(tmp, (13*s)/8); // 13/8 is within 0.5% of the golden ratio
            if (ttmp) {
                tmp = ttmp;
                s = (13*s)/8;
            } else {
                free(tmp);
                return 0;
            }