summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/omd.c1
-rw-r--r--src/toilet.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/omd.c b/src/omd.c
index c62b6a7..2291a6c 100644
--- a/src/omd.c
+++ b/src/omd.c
@@ -38,6 +38,7 @@ static char** parse_options(int argc, char **argv) {
}
static void reverse_in_place(char *buf, size_t len) {
+ // TODO: kijk of dit sneller kan met SIMD
for (size_t i = 0, j = len - 1; i < len / 2; i++, j--) {
char c = buf[i];
buf[i] = buf[j];
diff --git a/src/toilet.c b/src/toilet.c
index 24b19a4..fb011fa 100644
--- a/src/toilet.c
+++ b/src/toilet.c
@@ -73,6 +73,7 @@ size_t get_count(enum MODE mode, struct map *map) {
size_t words = 0;
assert(map->sb.st_size >= 0);
+ // (c) Tom Forging
for (size_t i = 0; i < (size_t)map->sb.st_size;) {
size_t previ = i;
while (!isspace(map->addr[i])) i++;
@@ -91,6 +92,7 @@ size_t get_count(enum MODE mode, struct map *map) {
map->addr++;
}
+ // handle case if file does not have trailing newline
if (*(map->addr - 1) != '\n') {
lines++;
}
@@ -104,7 +106,6 @@ int entry_toilet(int argc, char **argv) {
enum MODE mode;
char **args = parse_options(argc, argv, &mode);
-
while (*args != NULL) {
struct map *map = open_map(*args);
if (map == NULL) {