Skip to content

Commit

Permalink
Make DISABLED_LINE related comments understandable
Browse files Browse the repository at this point in the history
  • Loading branch information
nil0x42 committed Sep 4, 2020
1 parent 728cf80 commit 9f0a382
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/* medium line size for determining hashmap min size */
#define MEDIUM_LINE_BYTES (8)

/* this char is written at start of lines as a `removal mark` */
/* char used to mark duplicate lines for removal */
#define DISABLED_LINE '\0'

/* enable/disable multithreading feature */
Expand Down
5 changes: 2 additions & 3 deletions src/chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ bool get_next_chunk(t_chunk *chunk, struct file *file)
}


/** Apply 'zero tag' (DISABLED_LINE) on each `chunk`
* line that is already present in `hmap`.
/** Disable lines on `chunk` that already exist in `hmap`
* by tagging them with 'DISABLED_LINE'
* Main work for threads in thread pool.
*/
void cleanout_chunk(t_chunk *chunk)
Expand All @@ -79,7 +79,6 @@ void cleanout_chunk(t_chunk *chunk)
{
if (cmp_line(&line, &g_hmap.ptr[slot]) == 0)
{
/* apply 'zero tag' */
LINE_ADDR(line)[0] = DISABLED_LINE;
break;
}
Expand Down
1 change: 0 additions & 1 deletion src/hmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ void populate_hmap(t_chunk *chunk)
}
else if (cmp_line(&line, &g_hmap.ptr[slot]) == 0)
{
/* apply 'zero tag' */
LINE_ADDR(line)[0] = DISABLED_LINE;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct file *g_file;
struct hmap g_hmap;


/** Rewrite file without zero-tagged lines, and update file size.
/** Rewrite file, ignoring lines tagged with 'DISABLED_LINE'
*/
static void remove_duplicates(void)
{
Expand Down

0 comments on commit 9f0a382

Please sign in to comment.