From ca5f6f3d4bf53a00f81c5323325b2e4e40489aeb Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 27 Sep 2017 18:05:34 -0400 Subject: fix for: gdc compiled program when run, segfaults on certain actions --- org/meta_abstraction.org | 8 +++----- org/output_xmls.org | 4 ++-- src/sdp/meta/metadoc_from_src.d | 8 +++----- src/sdp/output/xmls.d | 4 ++-- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 1ddec75..322fb0c 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -54,6 +54,7 @@ template SiSUdocAbstraction() { /+ ↓ loop markup document/text line by line +/ srcDocLoop: foreach (line; markup_sourcefile_content) { + // "line" variable can be empty but should never be null /+ ↓ markup document/text line by line +/ <> if (obj_type_status["code"] == TriState.on) { @@ -1208,10 +1209,7 @@ if ((obj_type_status["heading"] == State.on) processing.remove("verse"); ++cntr; } else { - assert( - line == null, - "line variable should be empty, should not occur" - ); + // could be useful to test line variable should be empty and never null } #+END_SRC @@ -4303,7 +4301,7 @@ auto table_array_munge(O,T)( col_num_ = idx_c; _table_substantive ~= col ~ mng.tc_s; if (idx_r == 0 && comp_obj_block.table_heading) { - } else if (idx_r == 1 && col.match(rgx.numeric_col)) { + } else if (col.match(rgx.numeric_col) && idx_r == 1) { // conditions reversed to avoid: gdc compiled program run segfault if ((comp_obj_block.table_column_aligns.length > idx_c) && (comp_obj_block.table_column_aligns[idx_c].matchFirst(rgx.table_col_align_match))) { comp_obj_block.table_column_aligns[idx_c] diff --git a/org/output_xmls.org b/org/output_xmls.org index 4050a5e..ffbd7ed 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -409,8 +409,8 @@ auto inline_links(O)( string seg_scroll = "seg", ) { if (obj.inline_links) { - if ((seg_scroll == "scroll") - && _txt.match(rgx.mark_internal_site_lnk)) { + if ((_txt.match(rgx.mark_internal_site_lnk)) + && (seg_scroll == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault _txt = (_txt).replaceAll( rgx.inline_seg_link, "$1"); diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d index 82c6249..920e7af 100644 --- a/src/sdp/meta/metadoc_from_src.d +++ b/src/sdp/meta/metadoc_from_src.d @@ -355,6 +355,7 @@ template SiSUdocAbstraction() { /+ ↓ loop markup document/text line by line +/ srcDocLoop: foreach (line; markup_sourcefile_content) { + // "line" variable can be empty but should never be null /+ ↓ markup document/text line by line +/ /+ scope +/ scope(exit) { @@ -890,10 +891,7 @@ template SiSUdocAbstraction() { processing.remove("verse"); ++cntr; } else { - assert( - line == null, - "line variable should be empty, should not occur" - ); + // could be useful to test line variable should be empty and never null } } // close else for line empty } // close else for not the above @@ -3418,7 +3416,7 @@ template SiSUdocAbstraction() { col_num_ = idx_c; _table_substantive ~= col ~ mng.tc_s; if (idx_r == 0 && comp_obj_block.table_heading) { - } else if (idx_r == 1 && col.match(rgx.numeric_col)) { + } else if (col.match(rgx.numeric_col) && idx_r == 1) { // conditions reversed to avoid: gdc compiled program run segfault if ((comp_obj_block.table_column_aligns.length > idx_c) && (comp_obj_block.table_column_aligns[idx_c].matchFirst(rgx.table_col_align_match))) { comp_obj_block.table_column_aligns[idx_c] diff --git a/src/sdp/output/xmls.d b/src/sdp/output/xmls.d index 1181c6f..c100bbc 100644 --- a/src/sdp/output/xmls.d +++ b/src/sdp/output/xmls.d @@ -306,8 +306,8 @@ template outputXHTMLs() { string seg_scroll = "seg", ) { if (obj.inline_links) { - if ((seg_scroll == "scroll") - && _txt.match(rgx.mark_internal_site_lnk)) { + if ((_txt.match(rgx.mark_internal_site_lnk)) + && (seg_scroll == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault _txt = (_txt).replaceAll( rgx.inline_seg_link, "$1"); -- cgit v1.2.3