]> granicus.if.org Git - multimarkdown/commitdiff
UPDATED: Tidy up code
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Tue, 11 Jul 2017 21:36:17 +0000 (17:36 -0400)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Tue, 11 Jul 2017 21:36:17 +0000 (17:36 -0400)
Sources/libMultiMarkdown/mmd.c
Sources/libMultiMarkdown/opendocument-content.c
Sources/libMultiMarkdown/textbundle.c

index 9215b4baf6b348ccd7476576b2f023477fc7e902..3229e0c729532b46b7a3d2ac67f9188ed0b03f64 100644 (file)
@@ -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;
                }
 
index 8c590416c1ea15ba7114270bbcc004e277b40429..320d4b77ec44804167aafa16e02230f5261517db 100644 (file)
@@ -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("</text:a>");
 }
index 9559f588f4b085ba40a29480688aae9e7e8864cb..b8a0157ffc051ed767f7479798c1d6388303b140 100644 (file)
@@ -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/";