about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--merge.c6
-rw-r--r--meta.c6
-rw-r--r--server.c8
-rw-r--r--torus.h20
4 files changed, 21 insertions, 19 deletions
diff --git a/merge.c b/merge.c
index 2333e9d..bf1a1b5 100644
--- a/merge.c
+++ b/merge.c
@@ -87,9 +87,11 @@ int main(int argc, char *argv[]) {
         if (!lenA && !lenB) break;
         if (!lenA || !lenB) errx(EX_IOERR, "different size inputs");
 
-        const struct Tile *tileC = (tileA.access > tileB.access) ? &tileA : &tileB;
+        const struct Tile *tileC = (tileA.accessTime > tileB.accessTime)
+            ? &tileA
+            : &tileB;
 
-        if (tileA.modify != tileB.modify) {
+        if (tileA.modifyTime != tileB.modifyTime) {
             drawTile(0, &tileA);
             drawTile(CELL_ROWS + 1, &tileB);
             move(CELL_ROWS * 2 + 2, 0);
diff --git a/meta.c b/meta.c
index 569821b..cc6e262 100644
--- a/meta.c
+++ b/meta.c
@@ -33,11 +33,11 @@ int main() {
             "%d,%d,%ld,%u,%ld,%u,%ld\n",
             i % TILE_COLS,
             i / TILE_COLS,
-            tile.create,
+            tile.createTime,
             tile.modifyCount,
-            tile.modify,
+            tile.modifyTime,
             tile.accessCount,
-            tile.access
+            tile.accessTime
         );
     }
 }
diff --git a/server.c b/server.c
index 1c7d425..78752f5 100644
--- a/server.c
+++ b/server.c
@@ -58,24 +58,24 @@ static void tilesMap(void) {
 
 static struct Tile *tileGet(uint32_t tileX, uint32_t tileY) {
     struct Tile *tile = &tiles[tileY * TILE_ROWS + tileX];
-    if (!tile->create) {
+    if (!tile->createTime) {
         memset(tile->cells, ' ', CELLS_SIZE);
         memset(tile->colors, COLOR_WHITE, CELLS_SIZE);
-        tile->create = time(NULL);
+        tile->createTime = time(NULL);
     }
     return tile;
 }
 
 static struct Tile *tileAccess(uint32_t tileX, uint32_t tileY) {
     struct Tile *tile = tileGet(tileX, tileY);
-    tile->access = time(NULL);
+    tile->accessTime = time(NULL);
     tile->accessCount++;
     return tile;
 }
 
 static struct Tile *tileModify(uint32_t tileX, uint32_t tileY) {
     struct Tile *tile = tileGet(tileX, tileY);
-    tile->modify = time(NULL);
+    tile->modifyTime = time(NULL);
     tile->modifyCount++;
     return tile;
 }
diff --git a/torus.h b/torus.h
index 6d819a3..f2588a4 100644
--- a/torus.h
+++ b/torus.h
@@ -51,18 +51,18 @@ enum {
 #define CELL_INIT_X (CELL_COLS / 2)
 #define CELL_INIT_Y (CELL_ROWS / 2)
 
-struct Tile {
-    time_t create;
-    time_t modify;
-    char cells[CELL_ROWS][CELL_COLS] ALIGNED(16);
-    uint8_t colors[CELL_ROWS][CELL_COLS] ALIGNED(16);
+struct ALIGNED(4096) Tile {
+    time_t createTime;
+    time_t modifyTime;
+    char ALIGNED(16) cells[CELL_ROWS][CELL_COLS];
+    uint8_t ALIGNED(16) colors[CELL_ROWS][CELL_COLS];
     uint32_t modifyCount;
     uint32_t accessCount;
-    time_t access;
-} ALIGNED(4096);
-static_assert(sizeof(struct Tile) == 4096, "struct Tile is page-sized");
-static_assert(offsetof(struct Tile, cells) == 16, "stable cells offset");
-static_assert(offsetof(struct Tile, colors) == 2016, "stable colors offset");
+    time_t accessTime;
+};
+static_assert(4096 == sizeof(struct Tile), "struct File is page-sized");
+static_assert(16 == offsetof(struct Tile, cells), "stable cells offset");
+static_assert(2016 == offsetof(struct Tile, colors), "stable colors offset");
 
 #define TILE_ROWS (512)
 #define TILE_COLS (512)