From 3ef0718f9f4c9dea5014a8a0e9a67e2366b9374f Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Sun, 19 Jan 2020 13:45:40 +0100
Subject: Improve packing of struct cmark_list

Allows to reduce size of struct cmark_node later.
---
 src/html.c | 2 +-
 src/node.c | 8 ++++----
 src/node.h | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/html.c b/src/html.c
index f7da7c2..f3f4cd1 100644
--- a/src/html.c
+++ b/src/html.c
@@ -92,7 +92,7 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
     break;
 
   case CMARK_NODE_LIST: {
-    cmark_list_type list_type = node->as.list.list_type;
+    cmark_list_type list_type = (cmark_list_type)node->as.list.list_type;
     int start = node->as.list.start;
 
     if (entering) {
diff --git a/src/node.c b/src/node.c
index 931bd46..fd6526c 100644
--- a/src/node.c
+++ b/src/node.c
@@ -371,7 +371,7 @@ cmark_list_type cmark_node_get_list_type(cmark_node *node) {
   }
 
   if (node->type == CMARK_NODE_LIST) {
-    return node->as.list.list_type;
+    return (cmark_list_type)node->as.list.list_type;
   } else {
     return CMARK_NO_LIST;
   }
@@ -387,7 +387,7 @@ int cmark_node_set_list_type(cmark_node *node, cmark_list_type type) {
   }
 
   if (node->type == CMARK_NODE_LIST) {
-    node->as.list.list_type = type;
+    node->as.list.list_type = (unsigned char)type;
     return 1;
   } else {
     return 0;
@@ -400,7 +400,7 @@ cmark_delim_type cmark_node_get_list_delim(cmark_node *node) {
   }
 
   if (node->type == CMARK_NODE_LIST) {
-    return node->as.list.delimiter;
+    return (cmark_delim_type)node->as.list.delimiter;
   } else {
     return CMARK_NO_DELIM;
   }
@@ -416,7 +416,7 @@ int cmark_node_set_list_delim(cmark_node *node, cmark_delim_type delim) {
   }
 
   if (node->type == CMARK_NODE_LIST) {
-    node->as.list.delimiter = delim;
+    node->as.list.delimiter = (unsigned char)delim;
     return 1;
   } else {
     return 0;
diff --git a/src/node.h b/src/node.h
index fbf449c..ee0ff41 100644
--- a/src/node.h
+++ b/src/node.h
@@ -17,11 +17,11 @@ typedef struct {
 } cmark_literal;
 
 typedef struct {
-  cmark_list_type list_type;
   int marker_offset;
   int padding;
   int start;
-  cmark_delim_type delimiter;
+  unsigned char list_type;
+  unsigned char delimiter;
   unsigned char bullet_char;
   bool tight;
 } cmark_list;
-- 
cgit v1.2.3