Skip to content

Commit d123b40

Browse files
committed
Remove TODO comment in 'generate_histogram'
1 parent f2d019f commit d123b40

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/generate_histogram.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,15 @@ Image* generate_histogram(const Args* args, ByteArray* bytes) {
6262
return NULL;
6363
assert(image->height == 256);
6464

65-
/*
66-
* TODO: Perhaps abstract "occurrence counting" logic into a separate static
67-
* function.
68-
*/
69-
uint8_t most_frequent = 0;
70-
size_t* occurrences = calloc(256, sizeof(size_t));
65+
size_t* occurrences = calloc(256, sizeof(size_t));
7166
if (occurrences == NULL)
7267
return NULL;
7368

74-
/* Store the occurrences including the most frequent byte */
69+
/*
70+
* Count the number of occurrences of each byte, also storing which is the
71+
* most frequent byte.
72+
*/
73+
uint8_t most_frequent = 0;
7574
for (size_t i = 0; i < bytes->size; i++) {
7675
const uint8_t byte = bytes->data[i];
7776
occurrences[byte]++;

0 commit comments

Comments
 (0)