summaryrefslogtreecommitdiff
path: root/src/node.h
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-02-18 15:49:45 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-02-18 15:49:45 -0800
commit5e90436d9c90d6e8e5612cebb4266eea432168b4 (patch)
treea72f96b38e78088f79d278b73d04109072948275 /src/node.h
parent0f90fc3f7ec06dd032ab28ef0478c415f831862f (diff)
Packed cmark_node struct to fit into 128 bytes.
This gives a small performance boost (0.37 to 0.36).
Diffstat (limited to 'src/node.h')
-rw-r--r--src/node.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/node.h b/src/node.h
index 74eddd4..7a45d42 100644
--- a/src/node.h
+++ b/src/node.h
@@ -6,6 +6,7 @@ extern "C" {
#endif
#include <stdio.h>
+#include <stdint.h>
#include "cmark.h"
#include "buffer.h"
@@ -22,12 +23,13 @@ typedef struct {
} cmark_list;
typedef struct {
- bool fenced;
- int fence_length;
- int fence_offset;
- unsigned char fence_char;
cmark_chunk info;
cmark_chunk literal;
+ int fence_length;
+ /* fence_offset must be 0-3, so we can use int8_t */
+ int8_t fence_offset;
+ unsigned char fence_char;
+ bool fenced;
} cmark_code;
typedef struct {
@@ -41,8 +43,6 @@ typedef struct {
} cmark_link;
struct cmark_node {
- cmark_node_type type;
-
struct cmark_node *next;
struct cmark_node *prev;
struct cmark_node *parent;
@@ -55,6 +55,9 @@ struct cmark_node {
int start_column;
int end_line;
int end_column;
+
+ cmark_node_type type;
+
bool open;
bool last_line_blank;