From: Fletcher T. Penney Date: Tue, 11 Jul 2017 21:36:17 +0000 (-0400) Subject: UPDATED: Tidy up code X-Git-Tag: 6.2.0^2~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b14b1d5573e6fd005b0457a74c2c9011094bf314;p=multimarkdown UPDATED: Tidy up code --- diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index 9215b4b..3229e0c 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -1990,7 +1990,7 @@ bool mmd_d_string_has_metadata(DString * source, size_t * end) { /// Does the text have metadata? bool mmd_engine_has_metadata(mmd_engine * e, size_t * end) { bool result = false; - if (!e || !end) + if (!e) return false; if (!(scan_meta_line(&e->dstr->str[0]))) { @@ -2018,7 +2018,7 @@ bool mmd_engine_has_metadata(mmd_engine * e, size_t * end) { if (doc->child && doc->child->type == BLOCK_META) { result = true; - if (end != NULL) + if (end) *end = doc->child->len; } diff --git a/Sources/libMultiMarkdown/opendocument-content.c b/Sources/libMultiMarkdown/opendocument-content.c index 8c59041..320d4b7 100644 --- a/Sources/libMultiMarkdown/opendocument-content.c +++ b/Sources/libMultiMarkdown/opendocument-content.c @@ -333,8 +333,9 @@ void mmd_export_link_opendocument(DString * out, const char * source, token * te text->child->next->start--; text->child->next->len++; } - - mmd_export_token_tree_opendocument(out, source, text->child, scratch); + + if (text) + mmd_export_token_tree_opendocument(out, source, text->child, scratch); print_const(""); } diff --git a/Sources/libMultiMarkdown/textbundle.c b/Sources/libMultiMarkdown/textbundle.c index 9559f58..b8a0157 100644 --- a/Sources/libMultiMarkdown/textbundle.c +++ b/Sources/libMultiMarkdown/textbundle.c @@ -320,7 +320,7 @@ void traverse_for_images(token * t, DString * text, mmd_engine * e, long * offse void sub_asset_paths(DString * text, mmd_engine * e) { long offset = 0; - asset * a, * a_tmp; + asset * a; token * t = e->root->child; char destination[100] = "assets/";