Fix gcc warnings when building Release build.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
diff --git a/md4c/md4c.c b/md4c/md4c.c
index 7ea3371..1361beb 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -1462,7 +1462,7 @@ md_is_link_reference_definition(MD_CTX* ctx, const MD_LINE* lines, int n_lines)
{
OFF label_contents_beg;
OFF label_contents_end;
- int label_contents_line_index;
+ int label_contents_line_index = -1;
int label_is_multiline;
OFF dest_contents_beg;
OFF dest_contents_end;
@@ -1515,8 +1515,10 @@ md_is_link_reference_definition(MD_CTX* ctx, const MD_LINE* lines, int n_lines)
line_index += tmp_line_index;
} else {
/* Not a title. */
+ title_is_multiline = FALSE;
title_contents_beg = off;
title_contents_end = off;
+ title_contents_line_index = 0;
}
/* Nothing more can follow on the last line. */
@@ -1608,6 +1610,7 @@ md_link_label_eq(const CHAR* a_label, SZ a_size, const CHAR* b_label, SZ b_size)
a_is_whitespace = ISUNICODEWHITESPACE_(a_codepoint);
} else {
/* Treat end of label as a whitespace. */
+ a_codepoint = -1;
a_is_whitespace = TRUE;
}
@@ -1616,6 +1619,7 @@ md_link_label_eq(const CHAR* a_label, SZ a_size, const CHAR* b_label, SZ b_size)
b_is_whitespace = ISUNICODEWHITESPACE_(b_codepoint);
} else {
/* Treat end of label as a whitespace. */
+ b_codepoint = -1;
b_is_whitespace = TRUE;
}
@@ -1893,16 +1897,17 @@ md_mark_store_ptr(MD_CTX* ctx, int mark_index, void* ptr)
/* Check only members beg and end are misused for this. */
MD_ASSERT(sizeof(void*) <= 2 * sizeof(OFF));
-
- *((void**) &mark->beg) = ptr;
+ memcpy(mark, &ptr, sizeof(void*));
}
static inline void*
md_mark_get_ptr(MD_CTX* ctx, int mark_index)
{
+ void* ptr;
MD_MARK* mark = &ctx->marks[mark_index];
MD_ASSERT(mark->ch == 'D');
- return *((void**) &mark->beg);
+ memcpy(&ptr, mark, sizeof(void*));
+ return ptr;
}
static void