From 853fb923c9932b14546749368e531324b1e4f8cc Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Sat, 2 Jun 2012 13:11:38 +0900 Subject: [PATCH 01/11] beginning 0.4.0 development. I'll tune more faster this ext on this branch. --- php_sundown.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php_sundown.h b/php_sundown.h index 6682f5a..dde3360 100644 --- a/php_sundown.h +++ b/php_sundown.h @@ -3,7 +3,7 @@ #define PHP_SUNDOWN_H #define PHP_SUNDOWN_EXTNAME "sundown" -#define PHP_SUNDOWN_EXTVER "0.3.6" +#define PHP_SUNDOWN_EXTVER "0.4.0-beta" #ifdef HAVE_CONFIG_H #include "config.h" From ebae34bab59f98d293dc83642e0cb3ec0bd0a4b8 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Sun, 15 Jul 2012 23:29:21 +0800 Subject: [PATCH 02/11] Make travis report test failure since make test didn't report exit code please refer: https://github.com/reeze/php-leveldb/blob/master/travis/run-test.sh https://bugs.php.net/bug.php?id=60285 http://travis-ci.org/#!/reeze/php-sundown/jobs/1670528 --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index dde5010..b534c50 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,3 @@ - desc "compile php-sundown" task :compile => ['sundown/src/markdown.h'] do sh "phpize" @@ -19,6 +18,7 @@ desc "run php test cases" task :test do ENV["TESTS"] = "--show-diff -q" sh "make test" + sh "cat tests/*.diff; if [ $? -eq 0 ];then exit 1; fi" end desc "Run conformance tests" From 0a08969a1925a4064dd52523bda8b34ec4a20662 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Mon, 16 Jul 2012 01:08:39 +0800 Subject: [PATCH 03/11] Fix build in php-src there should no ';' after the macro, this will break build in php-src --- php_sundown.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php_sundown.h b/php_sundown.h index dde3360..96ccf60 100644 --- a/php_sundown.h +++ b/php_sundown.h @@ -24,7 +24,7 @@ * Zend will use when loading this module */ extern zend_module_entry sundown_module_entry; -#define phpext_sundown_ptr &sundown_module_entry; +#define phpext_sundown_ptr &sundown_module_entry extern zend_class_entry *sundown_class_entry, *php_sundown_buffer_class_entry; From 26b77d602d50bb8e313856821fba6df9386fda0b Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Sat, 4 Aug 2012 13:48:38 +0900 Subject: [PATCH 04/11] change submodule to vmg/sundown from tanoku/sundown fix #25 --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 3c559e3..da46d9c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "sundown"] path = sundown - url = https://github.com/tanoku/sundown.git + url = https://github.com/vmg/sundown.git ignore = dirty From 9a86d00af3c7617c72e2cf4dfefc92c8681e1571 Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Sat, 11 Aug 2012 02:22:52 +0900 Subject: [PATCH 05/11] fixes #26:prevent SEGV when calling Sundwon\Base\tableCell --- sundown_markdown.c | 13 +++++---- tests/999-regression-no26.phpt | 51 ++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 tests/999-regression-no26.phpt diff --git a/sundown_markdown.c b/sundown_markdown.c index 768a8f4..8481052 100644 --- a/sundown_markdown.c +++ b/sundown_markdown.c @@ -82,27 +82,28 @@ static void rndr_tablerow(struct buf *ob, const struct buf *text, void *opaque) static void rndr_tablecell(struct buf *ob, const struct buf *text, int align, void *opaque) { - zval php_align; + zval *php_align; + MAKE_STD_ZVAL(php_align); switch (align) { case MKD_TABLE_ALIGN_L: - ZVAL_STRING(&php_align, "left", 1); + ZVAL_STRING(php_align, "left", 1); break; case MKD_TABLE_ALIGN_R: - ZVAL_STRING(&php_align, "right", 1); + ZVAL_STRING(php_align, "right", 1); break; case MKD_TABLE_ALIGN_CENTER: - ZVAL_STRING(&php_align, "center", 1); + ZVAL_STRING(php_align, "center", 1); break; default: - ZVAL_NULL(&php_align); + ZVAL_NULL(php_align); break; } - BLOCK_CALLBACK_EX(ob,"tableCell", 2,buf2str(text), &php_align); + BLOCK_CALLBACK_EX(ob, "tableCell", 2, buf2str(text), php_align); } /*** diff --git a/tests/999-regression-no26.phpt b/tests/999-regression-no26.phpt new file mode 100644 index 0000000..68b4095 --- /dev/null +++ b/tests/999-regression-no26.phpt @@ -0,0 +1,51 @@ +--TEST-- +Check for https://github.com/chobie/php-sundown/issues/19 +--SKIPIF-- + +--FILE-- +true)); +echo $sd->toHTML(); + +//sementation fault: +$md = new \Sundown\Markdown(\Sundown\Render\HTML, array('tables'=>true)); +echo $md->render($table); +--EXPECT-- + + + + + + + + + + + + + + +
First HeaderSecond Header
Content CellContent Cell
Content CellContent Cell
+ + + + + + + + + + + + + + +
First HeaderSecond Header
Content CellContent Cell
Content CellContent Cell
\ No newline at end of file From a11eb98496c943c29c25e9eb6797072ca863fbd7 Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Sat, 11 Aug 2012 02:43:54 +0900 Subject: [PATCH 06/11] update CFLAGS for fix compile warnings --- config.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.m4 b/config.m4 index 2f1a4b1..7ea5ce1 100644 --- a/config.m4 +++ b/config.m4 @@ -20,7 +20,7 @@ sundown/html/houdini_html_e.c " PHP_NEW_EXTENSION(sundown,$SUNDOWN_SOURCES, $ext_shared) - CFLAGS=" -Wunused-variable -Wpointer-sign -Wimplicit-function-declaration" + CFLAGS="-Wunused-variable -Wpointer-sign -Wimplicit-function-declaration -Winline -Wunused-macros -Wredundant-decls -Wstrict-aliasing=2 -Wswitch-enum -Wdeclaration-after-statement" PHP_SUBST([CFLAGS]) PHP_ADD_BUILD_DIR([$ext_builddir/sundown/src]) From 7bc470396463700a59d585bdbc34dd556d8b5068 Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Sat, 11 Aug 2012 02:44:09 +0900 Subject: [PATCH 07/11] fix several compile warnings --- php_sundown.c | 8 +++---- php_sundown.h | 2 +- render_base.c | 4 ++-- render_html.c | 52 +++++++++++++++++++++++----------------------- render_html_toc.c | 32 ++++++++++++++-------------- sundown_markdown.c | 50 ++++++++++++++++++-------------------------- 6 files changed, 69 insertions(+), 79 deletions(-) diff --git a/php_sundown.c b/php_sundown.c index 6c9ce3a..c963195 100644 --- a/php_sundown.c +++ b/php_sundown.c @@ -60,7 +60,7 @@ static void sundown__render(SundownRendererType render_type, INTERNAL_FUNCTION_P buffer_len = strlen(buffer); memset(&input_buf, 0x0, sizeof(struct buf)); - input_buf.data = buffer; + input_buf.data = (uint8_t *)buffer; input_buf.size = strlen(buffer); output_buf = bufnew(128); @@ -90,11 +90,11 @@ static void sundown__render(SundownRendererType render_type, INTERNAL_FUNCTION_P if (Z_BVAL_P(zend_read_property(sundown_class_entry, getThis(),"enable_pants",sizeof("enable_pants")-1, 0 TSRMLS_CC))) { struct buf *smart_buf = bufnew(128); - sdhtml_smartypants(smart_buf, output_buf->data,output_buf->size); - RETVAL_STRINGL(smart_buf->data, smart_buf->size,1); + sdhtml_smartypants(smart_buf, output_buf->data, output_buf->size); + RETVAL_STRINGL((char*)smart_buf->data, smart_buf->size, 1); bufrelease(smart_buf); } else { - RETVAL_STRINGL(output_buf->data, output_buf->size,1); + RETVAL_STRINGL((char*)output_buf->data, output_buf->size, 1); } } diff --git a/php_sundown.h b/php_sundown.h index 96ccf60..e49bb8a 100644 --- a/php_sundown.h +++ b/php_sundown.h @@ -170,7 +170,7 @@ static inline zval* buf2str(const struct buf *text) if (text == NULL || text->size == 0) { ZVAL_NULL(str); } else { - ZVAL_STRINGL(str, text->data, text->size,1); + ZVAL_STRINGL(str, (char *)text->data, text->size, 1); } return str; } diff --git a/render_base.c b/render_base.c index 41b8b7a..d207e29 100644 --- a/render_base.c +++ b/render_base.c @@ -574,8 +574,8 @@ PHP_METHOD(sundown_render_base, postprocess) if (Z_BVAL_P(zend_read_property(Z_OBJCE_P(getThis()), getThis(),"enable_pants",sizeof("enable_pants")-1, 1 TSRMLS_CC))) { struct buf *smart_buf = bufnew(128); - sdhtml_smartypants(smart_buf, text,text_len); - RETVAL_STRINGL(smart_buf->data, smart_buf->size,1); + sdhtml_smartypants(smart_buf, (uint8_t *)text, text_len); + RETVAL_STRINGL((char*)smart_buf->data, smart_buf->size, 1); bufrelease(smart_buf); } else { RETVAL_STRINGL(text,text_len, 1); diff --git a/render_html.c b/render_html.c index b86f997..c2f76ae 100644 --- a/render_html.c +++ b/render_html.c @@ -189,7 +189,7 @@ PHP_METHOD(sundown_render_html, blockCode) html->cb.blockcode(output,lang,input, &base->html); bufrelease(input); bufrelease(lang); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -215,7 +215,7 @@ PHP_METHOD(sundown_render_html, blockQuote) output = bufnew(128); html->cb.blockquote(output,input, &base->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -241,7 +241,7 @@ PHP_METHOD(sundown_render_html, blockHtml) output = bufnew(128); html->cb.blockhtml(output,input, &base->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -268,7 +268,7 @@ PHP_METHOD(sundown_render_html, header) output = bufnew(128); html->cb.header(output,input,header_level, &base->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -283,7 +283,7 @@ PHP_METHOD(sundown_render_html, hrule) output = bufnew(128); html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); html->cb.hrule(output,&html->html); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } @@ -313,7 +313,7 @@ PHP_METHOD(sundown_render_html, listBox) if (input != NULL) { bufrelease(input); } - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -343,7 +343,7 @@ PHP_METHOD(sundown_render_html, listItem) bufrelease(input); } - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -369,7 +369,7 @@ PHP_METHOD(sundown_render_html, paragraph) output = bufnew(128); html->cb.paragraph(output,input, &base->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -395,7 +395,7 @@ PHP_METHOD(sundown_render_html, table) b_body = str2buf(body,body_len); output = bufnew(128); html->cb.table(output,b_header,b_body,&base->html); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(b_header); bufrelease(b_body); bufrelease(output); @@ -421,7 +421,7 @@ PHP_METHOD(sundown_render_html, tableRow) input = str2buf(contents, contents_len); output = bufnew(128); html->cb.table_row(output,input,&base->html); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(input); bufrelease(output); } @@ -448,7 +448,7 @@ PHP_METHOD(sundown_render_html, tableCell) input = str2buf(content, content_len); output = bufnew(128); html->cb.table_cell(output,input,alignment,&base->html); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(input); bufrelease(output); } @@ -474,7 +474,7 @@ PHP_METHOD(sundown_render_html, autolink) html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); html->cb.autolink(output,m_link,link_type, &html->html); bufrelease(m_link); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } @@ -499,7 +499,7 @@ PHP_METHOD(sundown_render_html, codespan) html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); html->cb.codespan(output,input, &html->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -525,7 +525,7 @@ PHP_METHOD(sundown_render_html, doubleEmphasis) output = bufnew(128); html->cb.double_emphasis(output,input, &base->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -551,7 +551,7 @@ PHP_METHOD(sundown_render_html, emphasis) output = bufnew(128); html->cb.emphasis(output,input, &base->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -581,7 +581,7 @@ PHP_METHOD(sundown_render_html, image) bufrelease(b_link); bufrelease(b_title); bufrelease(b_alt_text); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -596,7 +596,7 @@ PHP_METHOD(sundown_render_html, linebreak) output = bufnew(128); html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); html->cb.linebreak(output,&html->html); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -624,7 +624,7 @@ PHP_METHOD(sundown_render_html, link) bufrelease(m_link); bufrelease(m_title); bufrelease(m_content); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -648,7 +648,7 @@ PHP_METHOD(sundown_render_html, rawHtml) html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); html->cb.raw_html_tag(output,input, &html->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -672,7 +672,7 @@ PHP_METHOD(sundown_render_html, tripleEmphasis) output = bufnew(128); html->cb.triple_emphasis(output,input, &html->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -696,7 +696,7 @@ PHP_METHOD(sundown_render_html, strikethrough) output = bufnew(128); html->cb.strikethrough(output,input, &html->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -720,7 +720,7 @@ PHP_METHOD(sundown_render_html, superscript) output = bufnew(128); html->cb.superscript(output,input, &html->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -743,12 +743,12 @@ PHP_METHOD(sundown_render_html, entity) if (html->cb.entity) { input = str2buf(text, text_len); output = bufnew(128); - html->cb.entity(output,input, &html->html); + html->cb.entity(output, input, &html->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } else { - RETVAL_STRINGL(text,text_len, 1); + RETVAL_STRINGL((char *)text, text_len, 1); } } /* }}} */ @@ -772,7 +772,7 @@ PHP_METHOD(sundown_render_html, normalText) output = bufnew(128); html->cb.normal_text(output,input, &html->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ diff --git a/render_html_toc.c b/render_html_toc.c index 77a08b4..62975ea 100644 --- a/render_html_toc.c +++ b/render_html_toc.c @@ -213,10 +213,10 @@ PHP_METHOD(sundown_render_html_toc, header) html = (php_sundown_render_html_toc_t *) zend_object_store_get_object(getThis() TSRMLS_CC); base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(htext, htext_len); - output = bufnew(128); - html->cb.header(output,input,header_level, &base->html); + output = bufnew(128); + html->cb.header(output, input, header_level, &base->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -302,9 +302,9 @@ PHP_METHOD(sundown_render_html_toc, codespan) input = str2buf(code, code_len); output = bufnew(128); html = (php_sundown_render_html_toc_t *) zend_object_store_get_object(getThis() TSRMLS_CC); - html->cb.codespan(output,input, &html->html); + html->cb.codespan(output, input, &html->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -329,7 +329,7 @@ PHP_METHOD(sundown_render_html_toc, doubleEmphasis) output = bufnew(128); html->cb.double_emphasis(output,input, &base->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -355,7 +355,7 @@ PHP_METHOD(sundown_render_html_toc, emphasis) output = bufnew(128); html->cb.emphasis(output,input, &base->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -399,7 +399,7 @@ PHP_METHOD(sundown_render_html_toc, link) bufrelease(m_link); bufrelease(m_title); bufrelease(m_content); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -431,7 +431,7 @@ PHP_METHOD(sundown_render_html_toc, tripleEmphasis) output = bufnew(128); html->cb.triple_emphasis(output,input, &html->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -453,9 +453,9 @@ PHP_METHOD(sundown_render_html_toc, strikethrough) html = (php_sundown_render_html_toc_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(text, text_len); output = bufnew(128); - html->cb.strikethrough(output,input, &html->html); + html->cb.strikethrough(output, input, &html->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -479,7 +479,7 @@ PHP_METHOD(sundown_render_html_toc, superscript) output = bufnew(128); html->cb.superscript(output,input, &html->html); bufrelease(input); - RETVAL_STRINGL(output->data, output->size,1); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ @@ -500,11 +500,11 @@ PHP_METHOD(sundown_render_html_toc, normalText) int text_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s",&text, &text_len) == FAILURE) { + "s", &text, &text_len) == FAILURE) { return; } - RETVAL_STRINGL(text,text_len,1); + RETVAL_STRINGL(text, text_len, 1); } /* }}} */ @@ -525,8 +525,8 @@ PHP_METHOD(sundown_render_html_toc, docFooter) html = (php_sundown_render_html_toc_t *) zend_object_store_get_object(getThis() TSRMLS_CC); output = bufnew(128); - html->cb.doc_footer(output,&html->html); - RETVAL_STRINGL(output->data, output->size,1); + html->cb.doc_footer(output, &html->html); + RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ diff --git a/sundown_markdown.c b/sundown_markdown.c index 8481052..986be03 100644 --- a/sundown_markdown.c +++ b/sundown_markdown.c @@ -387,7 +387,6 @@ PHP_METHOD(sundown_markdown, __destruct) */ PHP_METHOD(sundown_markdown, render) { - php_sundown_markdown_t *object = (php_sundown_markdown_t *) zend_object_store_get_object(getThis() TSRMLS_CC); php_sundown_render_base_t *render_base; zval preprocess, postprocess, *params[1], *ret, *render, *m_retval; struct buf input_buf, *output_buf; @@ -411,23 +410,19 @@ PHP_METHOD(sundown_markdown, render) output_buf = bufnew(128); bufgrow(output_buf, buffer_len * 1.2f); - if (zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), NULL, "getrender", &render) == FAILURE) { - return; - } - - if (zend_call_method_with_0_params(&render, Z_OBJCE_P(render), NULL, "getrenderflags", &m_retval)) { - table = Z_ARRVAL_P(m_retval); - php_sundown__get_render_flags(table, &render_flags); - table = NULL; - zval_ptr_dtor(&m_retval); - } - - if (zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), NULL, "getextensions", &m_retval)) { - table = Z_ARRVAL_P(m_retval); - php_sundown__get_extensions(table, &enabled_extensions); - table = NULL; - zval_ptr_dtor(&m_retval); - } + zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), NULL, "getrender", &render); + + zend_call_method_with_0_params(&render, Z_OBJCE_P(render), NULL, "getrenderflags", &m_retval); + table = Z_ARRVAL_P(m_retval); + php_sundown__get_render_flags(table, &render_flags); + table = NULL; + zval_ptr_dtor(&m_retval); + + zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), NULL, "getextensions", &m_retval); + table = Z_ARRVAL_P(m_retval); + php_sundown__get_extensions(table, &enabled_extensions); + table = NULL; + zval_ptr_dtor(&m_retval); /* @todo: setup render */ switch (SUNDOWN_RENDER_HTML) { @@ -465,10 +460,10 @@ PHP_METHOD(sundown_markdown, render) memset(&input_buf, 0x0, sizeof(struct buf)); if (ret != NULL && Z_TYPE_P(ret) == IS_STRING) { - input_buf.data = Z_STRVAL_P(ret); + input_buf.data = (uint8_t *)Z_STRVAL_P(ret); input_buf.size = Z_STRLEN_P(ret); } else { - input_buf.data = buffer; + input_buf.data = (uint8_t *)buffer; input_buf.size = strlen(buffer); } zval_ptr_dtor(¶ms[0]); @@ -482,15 +477,15 @@ PHP_METHOD(sundown_markdown, render) /* postprocess */ MAKE_STD_ZVAL(ret); MAKE_STD_ZVAL(params[0]); - ZVAL_STRINGL(params[0], output_buf->data,output_buf->size, 1); + ZVAL_STRINGL(params[0], (char *)output_buf->data, output_buf->size, 1); ZVAL_STRING(&postprocess,"postprocess",1); if (call_user_function(NULL, &render, &postprocess, ret, 1, params TSRMLS_CC) == FAILURE) { } if (ret != NULL && Z_TYPE_P(ret) == IS_STRING) { - RETVAL_STRINGL(Z_STRVAL_P(ret), Z_STRLEN_P(ret),1); + RETVAL_STRINGL(Z_STRVAL_P(ret), Z_STRLEN_P(ret), 1); } else { - RETVAL_STRINGL(output_buf->data,output_buf->size,1); + RETVAL_STRINGL((char *)output_buf->data, output_buf->size, 1); } zval_ptr_dtor(&ret); zval_ptr_dtor(¶ms[0]); @@ -536,13 +531,8 @@ PHP_METHOD(sundown_markdown, hasRenderFlag) return; } - if (zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), NULL, "getrender", &render) == FAILURE) { - return; - } - - if (zend_call_method_with_0_params(&render, Z_OBJCE_P(render), NULL, "getrenderflags", &render_flags) == FAILURE) { - return; - } + zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), NULL, "getrender", &render); + zend_call_method_with_0_params(&render, Z_OBJCE_P(render), NULL, "getrenderflags", &render_flags); table = Z_ARRVAL_P(render_flags); RETVAL_BOOL(php_sundown_has_ext(table, name)); From 497d0a4318bb0a915ed8760983fcdaf2543db631 Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Sat, 11 Aug 2012 02:53:08 +0900 Subject: [PATCH 08/11] add a space after comma. --- php_sundown.c | 44 ++++++++++++------------ php_sundown.h | 22 ++++++------ render_base.c | 84 +++++++++++++++++++++++----------------------- render_html.c | 76 ++++++++++++++++++++--------------------- render_html_toc.c | 28 ++++++++-------- sundown_markdown.c | 82 ++++++++++++++++++++++---------------------- 6 files changed, 168 insertions(+), 168 deletions(-) diff --git a/php_sundown.c b/php_sundown.c index c963195..e240cfd 100644 --- a/php_sundown.c +++ b/php_sundown.c @@ -56,7 +56,7 @@ static void sundown__render(SundownRendererType render_type, INTERNAL_FUNCTION_P HashTable *table; object = getThis(); - buffer = Z_STRVAL_P(zend_read_property(sundown_class_entry, getThis(),"data",sizeof("data")-1, 0 TSRMLS_CC)); + buffer = Z_STRVAL_P(zend_read_property(sundown_class_entry, getThis(), "data", sizeof("data")-1, 0 TSRMLS_CC)); buffer_len = strlen(buffer); memset(&input_buf, 0x0, sizeof(struct buf)); @@ -66,8 +66,8 @@ static void sundown__render(SundownRendererType render_type, INTERNAL_FUNCTION_P output_buf = bufnew(128); bufgrow(output_buf, strlen(buffer) * 1.2f); - if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) { - table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC)); + if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) { + table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC)); } php_sundown__get_flags(table, &enabled_extensions, &render_flags); @@ -77,7 +77,7 @@ static void sundown__render(SundownRendererType render_type, INTERNAL_FUNCTION_P sdhtml_renderer(&sundown_render, &opt.html, render_flags); break; case SUNDOWN_RENDER_TOC: - sdhtml_toc_renderer(&sundown_render,&opt.html); + sdhtml_toc_renderer(&sundown_render, &opt.html); break; default: RETURN_FALSE; @@ -88,7 +88,7 @@ static void sundown__render(SundownRendererType render_type, INTERNAL_FUNCTION_P sd_markdown_render(output_buf, input_buf.data, input_buf.size, markdown); sd_markdown_free(markdown); - if (Z_BVAL_P(zend_read_property(sundown_class_entry, getThis(),"enable_pants",sizeof("enable_pants")-1, 0 TSRMLS_CC))) { + if (Z_BVAL_P(zend_read_property(sundown_class_entry, getThis(), "enable_pants", sizeof("enable_pants")-1, 0 TSRMLS_CC))) { struct buf *smart_buf = bufnew(128); sdhtml_smartypants(smart_buf, output_buf->data, output_buf->size); RETVAL_STRINGL((char*)smart_buf->data, smart_buf->size, 1); @@ -102,24 +102,24 @@ static void sundown__render(SundownRendererType render_type, INTERNAL_FUNCTION_P setup Sundown extension */ PHP_METHOD(sundown, __construct) { - zval *extensions = NULL,*c_extensions = NULL; + zval *extensions = NULL, *c_extensions = NULL; char *buffer; int buffer_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,"s|a",&buffer, &buffer_len, &extensions) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a", &buffer, &buffer_len, &extensions) == FAILURE) { return; } - add_property_string_ex(getThis(),"data",sizeof("data"),buffer,1 TSRMLS_CC); + add_property_string_ex(getThis(), "data", sizeof("data"), buffer, 1 TSRMLS_CC); if (extensions == NULL) { MAKE_STD_ZVAL(c_extensions); array_init(c_extensions); } else { ALLOC_INIT_ZVAL(c_extensions); - ZVAL_ZVAL(c_extensions,extensions,1,0); + ZVAL_ZVAL(c_extensions, extensions, 1, 0); } - add_property_zval_ex(getThis(),"extensions",sizeof("extensions"),c_extensions TSRMLS_CC); + add_property_zval_ex(getThis(), "extensions", sizeof("extensions"), c_extensions TSRMLS_CC); } /* }}} */ @@ -129,7 +129,7 @@ PHP_METHOD(sundown, __destruct) { zval *extensions; - extensions = zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC); + extensions = zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC); zval_ptr_dtor(&extensions); } /* }}} */ @@ -138,7 +138,7 @@ PHP_METHOD(sundown, __destruct) Returns converted HTML string */ PHP_METHOD(sundown, toHtml) { - sundown__render(SUNDOWN_RENDER_HTML,INTERNAL_FUNCTION_PARAM_PASSTHRU); + sundown__render(SUNDOWN_RENDER_HTML, INTERNAL_FUNCTION_PARAM_PASSTHRU); } /* }}} */ @@ -146,7 +146,7 @@ PHP_METHOD(sundown, toHtml) Returns converted HTML string */ PHP_METHOD(sundown, __toString) { - sundown__render(SUNDOWN_RENDER_HTML,INTERNAL_FUNCTION_PARAM_PASSTHRU); + sundown__render(SUNDOWN_RENDER_HTML, INTERNAL_FUNCTION_PARAM_PASSTHRU); } /* }}} */ @@ -154,7 +154,7 @@ PHP_METHOD(sundown, __toString) Returns table of contents*/ PHP_METHOD(sundown, toToc) { - sundown__render(SUNDOWN_RENDER_TOC,INTERNAL_FUNCTION_PARAM_PASSTHRU); + sundown__render(SUNDOWN_RENDER_TOC, INTERNAL_FUNCTION_PARAM_PASSTHRU); } @@ -172,8 +172,8 @@ PHP_METHOD(sundown, hasExtension) return; } - if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) { - table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC)); + if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) { + table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC)); RETVAL_BOOL(php_sundown_has_ext(table, name)); } } @@ -191,8 +191,8 @@ PHP_METHOD(sundown, hasRenderFlag) return; } - if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) { - table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC)); + if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) { + table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC)); RETVAL_BOOL(php_sundown_has_ext(table, name)); } } @@ -221,7 +221,7 @@ PHP_MINIT_FUNCTION(sundown) { php_sundown_render_html_toc_init(TSRMLS_C); php_sundown_markdown_init(TSRMLS_C); - REGISTER_NS_STRING_CONSTANT(ZEND_NS_NAME("Sundown","Render"), "HTML", "Sundown\\Render\\HTML", CONST_CS | CONST_PERSISTENT); + REGISTER_NS_STRING_CONSTANT(ZEND_NS_NAME("Sundown", "Render"), "HTML", "Sundown\\Render\\HTML", CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -229,9 +229,9 @@ PHP_MINIT_FUNCTION(sundown) { PHP_MINFO_FUNCTION(sundown) { php_info_print_table_start(); - php_info_print_table_header(2,"Sundown Support", "enabled"); - php_info_print_table_row(2,"Version", PHP_SUNDOWN_EXTVER); - php_info_print_table_row(2,"Sundown Version", SUNDOWN_VERSION); + php_info_print_table_header(2, "Sundown Support", "enabled"); + php_info_print_table_row(2, "Version", PHP_SUNDOWN_EXTVER); + php_info_print_table_row(2, "Sundown Version", SUNDOWN_VERSION); php_info_print_table_end(); } diff --git a/php_sundown.h b/php_sundown.h index e49bb8a..d7e6d62 100644 --- a/php_sundown.h +++ b/php_sundown.h @@ -73,15 +73,15 @@ typedef struct{ struct html_renderopt html; } php_sundown_render_base_t; -#define SPAN_CALLBACK_EX(buffer,method_name, ...) {\ +#define SPAN_CALLBACK_EX(buffer, method_name, ...) {\ struct php_sundown_renderopt_ex *opt = (struct php_sundown_renderopt_ex*)opaque;\ zval func, *ret;\ \ MAKE_STD_ZVAL(ret);\ - ZVAL_STRING(&func,method_name,1);\ + ZVAL_STRING(&func, method_name, 1);\ \ - if(call_user_function_v(NULL,&opt->self,&func,ret,__VA_ARGS__) == FAILURE){\ - fprintf(stderr,"Can't call method %s\n", method_name);\ + if(call_user_function_v(NULL, &opt->self, &func, ret, __VA_ARGS__) == FAILURE){\ + fprintf(stderr, "Can't call method %s\n", method_name);\ return 0;\ }\ if (ret != NULL) {\ @@ -93,15 +93,15 @@ typedef struct{ } -#define BLOCK_CALLBACK_EX(buffer,method_name, ...) {\ +#define BLOCK_CALLBACK_EX(buffer, method_name, ...) {\ struct php_sundown_renderopt_ex *opt = (struct php_sundown_renderopt_ex*)opaque;\ zval func, *ret;\ \ MAKE_STD_ZVAL(ret);\ - ZVAL_STRING(&func,method_name,1);\ + ZVAL_STRING(&func, method_name, 1);\ \ - if(call_user_function_v(NULL,&opt->self,&func,ret,__VA_ARGS__) == FAILURE){\ - fprintf(stderr,"Can't call method %s\n", method_name);\ + if(call_user_function_v(NULL, &opt->self, &func, ret, __VA_ARGS__) == FAILURE){\ + fprintf(stderr, "Can't call method %s\n", method_name);\ }\ if (ret != NULL) {\ bufput(buffer, Z_STRVAL_P(ret), Z_STRLEN_P(ret));\ @@ -149,7 +149,7 @@ static int call_user_function_v(HashTable *function_table, zval **object_pp, zva params = NULL; } - ret = call_user_function(function_table, object_pp, function_name, retval_ptr, param_count,params TSRMLS_CC); + ret = call_user_function(function_table, object_pp, function_name, retval_ptr, param_count, params TSRMLS_CC); if (param_count > 0) { for (i=0; idata, smart_buf->size, 1); bufrelease(smart_buf); } else { - RETVAL_STRINGL(text,text_len, 1); + RETVAL_STRINGL(text, text_len, 1); } } /* }}} */ @@ -601,7 +601,7 @@ PHP_METHOD(sundown_render_base, __construct) MAKE_STD_ZVAL(c_flags); array_init(c_flags); } - add_property_zval_ex(getThis(),"render_flags",sizeof("render_flags"),c_flags TSRMLS_CC); + add_property_zval_ex(getThis(), "render_flags", sizeof("render_flags"), c_flags TSRMLS_CC); } /* }}} */ @@ -612,10 +612,10 @@ PHP_METHOD(sundown_render_base, __construct) */ PHP_METHOD(sundown_render_base, getRenderFlags) { - if (Z_TYPE_P(zend_read_property(sundown_render_base_class_entry, getThis(),"render_flags",sizeof("render_flags")-1, 0 TSRMLS_CC)) != IS_NULL) { + if (Z_TYPE_P(zend_read_property(sundown_render_base_class_entry, getThis(), "render_flags", sizeof("render_flags")-1, 0 TSRMLS_CC)) != IS_NULL) { zval *tmp = NULL; - tmp = zend_read_property(sundown_render_base_class_entry, getThis(),"render_flags",sizeof("render_flags")-1, 0 TSRMLS_CC); + tmp = zend_read_property(sundown_render_base_class_entry, getThis(), "render_flags", sizeof("render_flags")-1, 0 TSRMLS_CC); RETVAL_ZVAL(tmp, 1, 0); } } @@ -632,11 +632,11 @@ PHP_METHOD(sundown_render_base, setRenderFlags) return; } MAKE_STD_ZVAL(c_render_flags); - ZVAL_ZVAL(c_render_flags,render_flags,1,0); + ZVAL_ZVAL(c_render_flags, render_flags, 1, 0); tmp = zend_read_property(sundown_render_base_class_entry, getThis(), "render_flags", sizeof("render_flags")-1, 0 TSRMLS_CC); zval_ptr_dtor(&tmp); - add_property_zval_ex(getThis(),"render_flags",sizeof("render_flags"),c_render_flags TSRMLS_CC); + add_property_zval_ex(getThis(), "render_flags", sizeof("render_flags"), c_render_flags TSRMLS_CC); } /* }}} */ @@ -646,7 +646,7 @@ PHP_METHOD(sundown_render_base, setRenderFlags) PHP_METHOD(sundown_render_base, __destruct) { zval *render_flags; - render_flags = zend_read_property(sundown_render_base_class_entry, getThis(),"render_flags",sizeof("render_flags")-1, 0 TSRMLS_CC); + render_flags = zend_read_property(sundown_render_base_class_entry, getThis(), "render_flags", sizeof("render_flags")-1, 0 TSRMLS_CC); if (Z_TYPE_P(render_flags) == IS_ARRAY) { zval_ptr_dtor(&render_flags); } @@ -691,7 +691,7 @@ static zend_function_entry php_sundown_render_base_methods[] = { void php_sundown_render_base_init(TSRMLS_D) { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, ZEND_NS_NAME("Sundown","Render"),"Base", php_sundown_render_base_methods); + INIT_NS_CLASS_ENTRY(ce, ZEND_NS_NAME("Sundown", "Render"), "Base", php_sundown_render_base_methods); sundown_render_base_class_entry = zend_register_internal_class(&ce TSRMLS_CC); sundown_render_base_class_entry->create_object = php_sundown_render_base_new; zend_declare_property_null(sundown_render_base_class_entry, "render_flags", sizeof("render_flags")-1, ZEND_ACC_PUBLIC TSRMLS_CC); diff --git a/render_html.c b/render_html.c index c2f76ae..89b6b9e 100644 --- a/render_html.c +++ b/render_html.c @@ -177,7 +177,7 @@ PHP_METHOD(sundown_render_html, blockCode) php_sundown_render_base_t *base; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "ss",&code, &code_len, &block_code, &block_code_len) == FAILURE) { + "ss", &code, &code_len, &block_code, &block_code_len) == FAILURE) { return; } @@ -186,7 +186,7 @@ PHP_METHOD(sundown_render_html, blockCode) input = str2buf(block_code, block_code_len); lang = str2buf(code, code_len); output = bufnew(128); - html->cb.blockcode(output,lang,input, &base->html); + html->cb.blockcode(output, lang, input, &base->html); bufrelease(input); bufrelease(lang); RETVAL_STRINGL((char *)output->data, output->size, 1); @@ -213,7 +213,7 @@ PHP_METHOD(sundown_render_html, blockQuote) base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(quote, quote_len); output = bufnew(128); - html->cb.blockquote(output,input, &base->html); + html->cb.blockquote(output, input, &base->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -239,14 +239,14 @@ PHP_METHOD(sundown_render_html, blockHtml) base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC);\ input = str2buf(raw, raw_len); output = bufnew(128); - html->cb.blockhtml(output,input, &base->html); + html->cb.blockhtml(output, input, &base->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ -/* {{{ proto string Sundown\Render\HTML::header($htext,$header_level) +/* {{{ proto string Sundown\Render\HTML::header($htext, $header_level) */ PHP_METHOD(sundown_render_html, header) { @@ -258,7 +258,7 @@ PHP_METHOD(sundown_render_html, header) php_sundown_render_base_t *base; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "sl",&htext, &htext_len, &header_level) == FAILURE) { + "sl", &htext, &htext_len, &header_level) == FAILURE) { return; } @@ -266,7 +266,7 @@ PHP_METHOD(sundown_render_html, header) base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(htext, htext_len); output = bufnew(128); - html->cb.header(output,input,header_level, &base->html); + html->cb.header(output, input, header_level, &base->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -282,7 +282,7 @@ PHP_METHOD(sundown_render_html, hrule) output = bufnew(128); html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); - html->cb.hrule(output,&html->html); + html->cb.hrule(output, &html->html); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -309,7 +309,7 @@ PHP_METHOD(sundown_render_html, listBox) base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC);\ input = str2buf(contents, contents_len); output = bufnew(128); - html->cb.list(output,input,list_type, &base->html); + html->cb.list(output, input, list_type, &base->html); if (input != NULL) { bufrelease(input); } @@ -325,7 +325,7 @@ PHP_METHOD(sundown_render_html, listItem) char *text; int text_len; long list_type; - struct buf *input,*output; + struct buf *input, *output; php_sundown_render_html_t *html; php_sundown_render_base_t *base; @@ -338,7 +338,7 @@ PHP_METHOD(sundown_render_html, listItem) base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(text, text_len); output = bufnew(128); - html->cb.listitem(output,input,list_type, &base->html); + html->cb.listitem(output, input, list_type, &base->html); if (input != NULL) { bufrelease(input); } @@ -367,7 +367,7 @@ PHP_METHOD(sundown_render_html, paragraph) base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(text, text_len); output = bufnew(128); - html->cb.paragraph(output,input, &base->html); + html->cb.paragraph(output, input, &base->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -380,7 +380,7 @@ PHP_METHOD(sundown_render_html, table) { char *header, *body; int header_len, body_len; - struct buf *b_header,*b_body,*output; + struct buf *b_header, *b_body, *output; php_sundown_render_html_t *html; php_sundown_render_base_t *base; @@ -392,9 +392,9 @@ PHP_METHOD(sundown_render_html, table) html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC); b_header = str2buf(header, header_len); - b_body = str2buf(body,body_len); + b_body = str2buf(body, body_len); output = bufnew(128); - html->cb.table(output,b_header,b_body,&base->html); + html->cb.table(output, b_header, b_body, &base->html); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(b_header); bufrelease(b_body); @@ -408,7 +408,7 @@ PHP_METHOD(sundown_render_html, tableRow) { char *contents; int contents_len; - struct buf *output,*input; + struct buf *output, *input; php_sundown_render_html_t *html; php_sundown_render_base_t *base; @@ -420,7 +420,7 @@ PHP_METHOD(sundown_render_html, tableRow) base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(contents, contents_len); output = bufnew(128); - html->cb.table_row(output,input,&base->html); + html->cb.table_row(output, input, &base->html); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(input); bufrelease(output); @@ -447,7 +447,7 @@ PHP_METHOD(sundown_render_html, tableCell) base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(content, content_len); output = bufnew(128); - html->cb.table_cell(output,input,alignment,&base->html); + html->cb.table_cell(output, input, alignment, &base->html); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(input); bufrelease(output); @@ -472,7 +472,7 @@ PHP_METHOD(sundown_render_html, autolink) m_link = str2buf(link, link_len); output = bufnew(128); html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); - html->cb.autolink(output,m_link,link_type, &html->html); + html->cb.autolink(output, m_link, link_type, &html->html); bufrelease(m_link); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -497,7 +497,7 @@ PHP_METHOD(sundown_render_html, codespan) input = str2buf(code, code_len); output = bufnew(128); html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); - html->cb.codespan(output,input, &html->html); + html->cb.codespan(output, input, &html->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -515,7 +515,7 @@ PHP_METHOD(sundown_render_html, doubleEmphasis) php_sundown_render_base_t *base; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s",&text, &text_len) == FAILURE) { + "s", &text, &text_len) == FAILURE) { return; } @@ -523,7 +523,7 @@ PHP_METHOD(sundown_render_html, doubleEmphasis) base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC);\ input = str2buf(text, text_len); output = bufnew(128); - html->cb.double_emphasis(output,input, &base->html); + html->cb.double_emphasis(output, input, &base->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -549,7 +549,7 @@ PHP_METHOD(sundown_render_html, emphasis) base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(text, text_len); output = bufnew(128); - html->cb.emphasis(output,input, &base->html); + html->cb.emphasis(output, input, &base->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -562,7 +562,7 @@ PHP_METHOD(sundown_render_html, image) { char *link, *title, *alt_text; int link_len, title_len, alt_text_len; - struct buf *b_link,*b_title, *b_alt_text, *output; + struct buf *b_link, *b_title, *b_alt_text, *output; php_sundown_render_html_t *html; php_sundown_render_base_t *base; @@ -577,7 +577,7 @@ PHP_METHOD(sundown_render_html, image) b_title = str2buf(title, title_len); b_alt_text = str2buf(alt_text, alt_text_len); output = bufnew(128); - html->cb.image(output,b_link,b_title,b_alt_text, &base->html); + html->cb.image(output, b_link, b_title, b_alt_text, &base->html); bufrelease(b_link); bufrelease(b_title); bufrelease(b_alt_text); @@ -595,13 +595,13 @@ PHP_METHOD(sundown_render_html, linebreak) output = bufnew(128); html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); - html->cb.linebreak(output,&html->html); + html->cb.linebreak(output, &html->html); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); } /* }}} */ -/* {{{ proto string Sundown\Render\HTML::link($link,$title,$content) +/* {{{ proto string Sundown\Render\HTML::link($link, $title, $content) */ PHP_METHOD(sundown_render_html, link) { @@ -611,7 +611,7 @@ PHP_METHOD(sundown_render_html, link) php_sundown_render_html_t *html; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "sss",&link, &link_len, &title, &title_len, &content, &content_len) == FAILURE) { + "sss", &link, &link_len, &title, &title_len, &content, &content_len) == FAILURE) { return; } @@ -620,7 +620,7 @@ PHP_METHOD(sundown_render_html, link) m_title = str2buf(title, title_len); m_content = str2buf(content, content_len); output = bufnew(128); - html->cb.link(output,m_link, m_title, m_content, &html->html); + html->cb.link(output, m_link, m_title, m_content, &html->html); bufrelease(m_link); bufrelease(m_title); bufrelease(m_content); @@ -646,7 +646,7 @@ PHP_METHOD(sundown_render_html, rawHtml) input = str2buf(raw, raw_len); output = bufnew(128); html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); - html->cb.raw_html_tag(output,input, &html->html); + html->cb.raw_html_tag(output, input, &html->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -670,7 +670,7 @@ PHP_METHOD(sundown_render_html, tripleEmphasis) html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(text, text_len); output = bufnew(128); - html->cb.triple_emphasis(output,input, &html->html); + html->cb.triple_emphasis(output, input, &html->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -694,7 +694,7 @@ PHP_METHOD(sundown_render_html, strikethrough) html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(text, text_len); output = bufnew(128); - html->cb.strikethrough(output,input, &html->html); + html->cb.strikethrough(output, input, &html->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -711,14 +711,14 @@ PHP_METHOD(sundown_render_html, superscript) php_sundown_render_html_t *html; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s",&text, &text_len) == FAILURE) { + "s", &text, &text_len) == FAILURE) { return; } html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(text, text_len); output = bufnew(128); - html->cb.superscript(output,input, &html->html); + html->cb.superscript(output, input, &html->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -770,7 +770,7 @@ PHP_METHOD(sundown_render_html, normalText) html = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(text, text_len); output = bufnew(128); - html->cb.normal_text(output,input, &html->html); + html->cb.normal_text(output, input, &html->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -813,7 +813,7 @@ PHP_METHOD(sundown_render_html, __construct) MAKE_STD_ZVAL(c_flags); array_init(c_flags); } - add_property_zval_ex(getThis(),"render_flags",sizeof("render_flags"),c_flags TSRMLS_CC); + add_property_zval_ex(getThis(), "render_flags", sizeof("render_flags"), c_flags TSRMLS_CC); object = (php_sundown_render_html_t *) zend_object_store_get_object(getThis() TSRMLS_CC); sdhtml_renderer(&object->cb, &opt.html, 0); @@ -849,14 +849,14 @@ static zend_function_entry php_sundown_render_html_methods[] = { PHP_ME(sundown_render_html, normalText, arginfo_sundown_render_html_normal_text, ZEND_ACC_PUBLIC) PHP_ME(sundown_render_html, docHeader, arginfo_sundown_render_html_doc_header, ZEND_ACC_PUBLIC) PHP_ME(sundown_render_html, docFooter, arginfo_sundown_render_html_doc_footer, ZEND_ACC_PUBLIC) - {NULL,NULL,NULL} + {NULL, NULL, NULL} }; void php_sundown_render_html_init(TSRMLS_D) { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, ZEND_NS_NAME("Sundown","Render"),"HTML", php_sundown_render_html_methods); + INIT_NS_CLASS_ENTRY(ce, ZEND_NS_NAME("Sundown", "Render"), "HTML", php_sundown_render_html_methods); sundown_render_html_class_entry = zend_register_internal_class_ex(&ce, sundown_render_base_class_entry, NULL TSRMLS_CC); sundown_render_html_class_entry->create_object = php_sundown_render_html_new; zend_declare_property_null(sundown_render_html_class_entry, "render_flags", sizeof("render_flags")-1, ZEND_ACC_PUBLIC TSRMLS_CC); diff --git a/render_html_toc.c b/render_html_toc.c index 62975ea..8a74f64 100644 --- a/render_html_toc.c +++ b/render_html_toc.c @@ -194,7 +194,7 @@ PHP_METHOD(sundown_render_html_toc, blockHtml) } /* }}} */ -/* {{{ proto string Sundown\Render\HTML_TOC::header($htext,$header_level) +/* {{{ proto string Sundown\Render\HTML_TOC::header($htext, $header_level) */ PHP_METHOD(sundown_render_html_toc, header) { @@ -206,7 +206,7 @@ PHP_METHOD(sundown_render_html_toc, header) php_sundown_render_base_t *base; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "sl",&htext, &htext_len, &header_level) == FAILURE) { + "sl", &htext, &htext_len, &header_level) == FAILURE) { return; } @@ -319,7 +319,7 @@ PHP_METHOD(sundown_render_html_toc, doubleEmphasis) php_sundown_render_html_toc_t *html; php_sundown_render_base_t *base; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s",&text, &text_len) == FAILURE) { + "s", &text, &text_len) == FAILURE) { return; } @@ -327,7 +327,7 @@ PHP_METHOD(sundown_render_html_toc, doubleEmphasis) base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC);\ input = str2buf(text, text_len); output = bufnew(128); - html->cb.double_emphasis(output,input, &base->html); + html->cb.double_emphasis(output, input, &base->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -353,7 +353,7 @@ PHP_METHOD(sundown_render_html_toc, emphasis) base = (php_sundown_render_base_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(text, text_len); output = bufnew(128); - html->cb.emphasis(output,input, &base->html); + html->cb.emphasis(output, input, &base->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -376,7 +376,7 @@ PHP_METHOD(sundown_render_html_toc, linebreak) } /* }}} */ -/* {{{ proto string Sundown\Render\HTML_TOC::link($link,$title,$content) +/* {{{ proto string Sundown\Render\HTML_TOC::link($link, $title, $content) */ PHP_METHOD(sundown_render_html_toc, link) { @@ -386,7 +386,7 @@ PHP_METHOD(sundown_render_html_toc, link) php_sundown_render_html_toc_t *html; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "sss",&link, &link_len, &title, &title_len, &content, &content_len) == FAILURE) { + "sss", &link, &link_len, &title, &title_len, &content, &content_len) == FAILURE) { return; } @@ -395,7 +395,7 @@ PHP_METHOD(sundown_render_html_toc, link) m_title = str2buf(title, title_len); m_content = str2buf(content, content_len); output = bufnew(128); - html->cb.link(output,m_link, m_title, m_content, &html->html); + html->cb.link(output, m_link, m_title, m_content, &html->html); bufrelease(m_link); bufrelease(m_title); bufrelease(m_content); @@ -429,7 +429,7 @@ PHP_METHOD(sundown_render_html_toc, tripleEmphasis) html = (php_sundown_render_html_toc_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(text, text_len); output = bufnew(128); - html->cb.triple_emphasis(output,input, &html->html); + html->cb.triple_emphasis(output, input, &html->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -470,14 +470,14 @@ PHP_METHOD(sundown_render_html_toc, superscript) php_sundown_render_html_toc_t *html; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "s",&text, &text_len) == FAILURE) { + "s", &text, &text_len) == FAILURE) { return; } html = (php_sundown_render_html_toc_t *) zend_object_store_get_object(getThis() TSRMLS_CC); input = str2buf(text, text_len); output = bufnew(128); - html->cb.superscript(output,input, &html->html); + html->cb.superscript(output, input, &html->html); bufrelease(input); RETVAL_STRINGL((char *)output->data, output->size, 1); bufrelease(output); @@ -551,7 +551,7 @@ PHP_METHOD(sundown_render_html_toc, __construct) MAKE_STD_ZVAL(c_flags); array_init(c_flags); } - add_property_zval_ex(getThis(),"render_flags",sizeof("render_flags"),c_flags TSRMLS_CC); + add_property_zval_ex(getThis(), "render_flags", sizeof("render_flags"), c_flags TSRMLS_CC); object = (php_sundown_render_html_toc_t *) zend_object_store_get_object(getThis() TSRMLS_CC); sdhtml_toc_renderer(&object->cb, &opt.html); @@ -587,14 +587,14 @@ static zend_function_entry php_sundown_render_html_toc_methods[] = { PHP_ME(sundown_render_html_toc, normalText, arginfo_sundown_render_html_toc_normal_text, ZEND_ACC_PUBLIC) PHP_ME(sundown_render_html_toc, docHeader, arginfo_sundown_render_html_toc_doc_header, ZEND_ACC_PUBLIC) PHP_ME(sundown_render_html_toc, docFooter, arginfo_sundown_render_html_toc_doc_footer, ZEND_ACC_PUBLIC) - {NULL,NULL,NULL} + {NULL, NULL, NULL} }; void php_sundown_render_html_toc_init(TSRMLS_D) { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, ZEND_NS_NAME("Sundown","Render"),"HTML_TOC", php_sundown_render_html_toc_methods); + INIT_NS_CLASS_ENTRY(ce, ZEND_NS_NAME("Sundown", "Render"), "HTML_TOC", php_sundown_render_html_toc_methods); sundown_render_html_toc_class_entry = zend_register_internal_class_ex(&ce, sundown_render_base_class_entry, NULL TSRMLS_CC); sundown_render_html_toc_class_entry->create_object = php_sundown_render_html_toc_new; zend_declare_property_null(sundown_render_html_toc_class_entry, "render_flags", sizeof("render_flags")-1, ZEND_ACC_PUBLIC TSRMLS_CC); diff --git a/sundown_markdown.c b/sundown_markdown.c index 986be03..3986497 100644 --- a/sundown_markdown.c +++ b/sundown_markdown.c @@ -25,27 +25,27 @@ zend_class_entry *sundown_markdown_class_entry; static void rndr_blockcode(struct buf *ob, const struct buf *text, const struct buf *lang, void *opaque) { - BLOCK_CALLBACK_EX(ob,"blockCode", 2, buf2str(text), buf2str(lang)); + BLOCK_CALLBACK_EX(ob, "blockCode", 2, buf2str(text), buf2str(lang)); } static void rndr_blockquote(struct buf *ob, const struct buf *text, void *opaque) { - BLOCK_CALLBACK_EX(ob,"blockQuote", 1, buf2str(text)); + BLOCK_CALLBACK_EX(ob, "blockQuote", 1, buf2str(text)); } static void rndr_raw_block(struct buf *ob, const struct buf *text, void *opaque) { - BLOCK_CALLBACK_EX(ob,"blockHtml", 1, buf2str(text)); + BLOCK_CALLBACK_EX(ob, "blockHtml", 1, buf2str(text)); } static void rndr_header(struct buf *ob, const struct buf *text, int level, void *opaque) { - BLOCK_CALLBACK_EX(ob,"header", 2, buf2str(text), buf2long(level)); + BLOCK_CALLBACK_EX(ob, "header", 2, buf2str(text), buf2long(level)); } static void rndr_hrule(struct buf *ob, void *opaque) { - BLOCK_CALLBACK_EX(ob,"hrule", 0); + BLOCK_CALLBACK_EX(ob, "hrule", 0); } static void rndr_list(struct buf *ob, const struct buf *text, int flags, void *opaque) @@ -53,7 +53,7 @@ static void rndr_list(struct buf *ob, const struct buf *text, int flags, void *o zval *flag; MAKE_STD_ZVAL(flag); ZVAL_LONG(flag, flags); - BLOCK_CALLBACK_EX(ob,"listBox", 2,buf2str(text),flag); + BLOCK_CALLBACK_EX(ob, "listBox", 2, buf2str(text), flag); } @@ -62,22 +62,22 @@ static void rndr_listitem(struct buf *ob, const struct buf *text, int flags, voi zval *flag; MAKE_STD_ZVAL(flag); ZVAL_LONG(flag, flags); - BLOCK_CALLBACK_EX(ob,"listItem", 2, buf2str(text),flag); + BLOCK_CALLBACK_EX(ob, "listItem", 2, buf2str(text), flag); } static void rndr_paragraph(struct buf *ob, const struct buf *text, void *opaque) { - BLOCK_CALLBACK_EX(ob,"paragraph", 1,buf2str(text)); + BLOCK_CALLBACK_EX(ob, "paragraph", 1, buf2str(text)); } static void rndr_table(struct buf *ob, const struct buf *header, const struct buf *body, void *opaque) { - BLOCK_CALLBACK_EX(ob,"table", 2, buf2str(header), buf2str(body)); + BLOCK_CALLBACK_EX(ob, "table", 2, buf2str(header), buf2str(body)); } static void rndr_tablerow(struct buf *ob, const struct buf *text, void *opaque) { - BLOCK_CALLBACK_EX(ob,"tableRow", 1, buf2str(text)); + BLOCK_CALLBACK_EX(ob, "tableRow", 1, buf2str(text)); } static void rndr_tablecell(struct buf *ob, const struct buf *text, int align, void *opaque) @@ -111,37 +111,37 @@ static void rndr_tablecell(struct buf *ob, const struct buf *text, int align, vo */ static int rndr_autolink(struct buf *ob, const struct buf *link, enum mkd_autolink type, void *opaque) { - SPAN_CALLBACK_EX(ob,"autolink", 2,buf2str(link),buf2long(type)); + SPAN_CALLBACK_EX(ob, "autolink", 2, buf2str(link), buf2long(type)); } static int rndr_codespan(struct buf *ob, const struct buf *text, void *opaque) { - SPAN_CALLBACK_EX(ob,"codespan", 1, buf2str(text)); + SPAN_CALLBACK_EX(ob, "codespan", 1, buf2str(text)); } static int rndr_double_emphasis(struct buf *ob, const struct buf *text, void *opaque) { - SPAN_CALLBACK_EX(ob,"doubleEmphasis", 1, buf2str(text)); + SPAN_CALLBACK_EX(ob, "doubleEmphasis", 1, buf2str(text)); } static int rndr_emphasis(struct buf *ob, const struct buf *text, void *opaque) { - SPAN_CALLBACK_EX(ob,"emphasis", 1, buf2str(text)); + SPAN_CALLBACK_EX(ob, "emphasis", 1, buf2str(text)); } static int rndr_image(struct buf *ob, const struct buf *link, const struct buf *title, const struct buf *alt, void *opaque) { - SPAN_CALLBACK_EX(ob,"image", 3, buf2str(link), buf2str(title), buf2str(alt)); + SPAN_CALLBACK_EX(ob, "image", 3, buf2str(link), buf2str(title), buf2str(alt)); } static int rndr_linebreak(struct buf *ob, void *opaque) { - SPAN_CALLBACK_EX(ob,"linebreak", 0); + SPAN_CALLBACK_EX(ob, "linebreak", 0); } static int rndr_link(struct buf *ob, const struct buf *link, const struct buf *title, const struct buf *content, void *opaque) { - SPAN_CALLBACK_EX(ob,"link", 3, buf2str(link), buf2str(title), buf2str(content)); + SPAN_CALLBACK_EX(ob, "link", 3, buf2str(link), buf2str(title), buf2str(content)); } static int rndr_raw_html(struct buf *ob, const struct buf *text, void *opaque) @@ -322,23 +322,23 @@ PHP_METHOD(sundown_markdown, __construct) if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z|a", &render, &extensions) == FAILURE) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC," Sundown\\Markdown::__construct() expects parameter 2 to be array"); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, " Sundown\\Markdown::__construct() expects parameter 2 to be array"); return; } if (Z_TYPE_P(render) == IS_STRING) { if (zend_lookup_class(Z_STRVAL_P(render), strlen(Z_STRVAL_P(render)), &ce TSRMLS_CC) == FAILURE) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,"class %s does not find.", Z_STRVAL_P(render)); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "class %s does not find.", Z_STRVAL_P(render)); return; } else { - zval *func,*ret, *obj; + zval *func, *ret, *obj; MAKE_STD_ZVAL(func); MAKE_STD_ZVAL(ret); MAKE_STD_ZVAL(obj); - ZVAL_STRING(func,"__construct",1); + ZVAL_STRING(func, "__construct", 1); object_init_ex(obj, *ce); - call_user_function(NULL, &obj,func,ret,0,NULL TSRMLS_CC); + call_user_function(NULL, &obj, func, ret, 0, NULL TSRMLS_CC); zval_ptr_dtor(&func); zval_ptr_dtor(&ret); render = obj; @@ -347,13 +347,13 @@ PHP_METHOD(sundown_markdown, __construct) // nothing todo. Z_ADDREF_P(render); } else { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,"Render class must extend Sundown\\Render\\Base"); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Render class must extend Sundown\\Render\\Base"); return; } if (!instanceof_function_ex(Z_OBJCE_P(render), sundown_render_base_class_entry, 0 TSRMLS_CC)) { Z_DELREF_P(render); - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,"Render class must extend Sundown\\Render\\Base"); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Render class must extend Sundown\\Render\\Base"); return; } object->render = render; @@ -363,9 +363,9 @@ PHP_METHOD(sundown_markdown, __construct) array_init(c_extensions); } else { ALLOC_INIT_ZVAL(c_extensions); - ZVAL_ZVAL(c_extensions,extensions,1,0); + ZVAL_ZVAL(c_extensions, extensions, 1, 0); } - add_property_zval_ex(getThis(),"extensions",sizeof("extensions"),c_extensions TSRMLS_CC); + add_property_zval_ex(getThis(), "extensions", sizeof("extensions"), c_extensions TSRMLS_CC); } /* }}} */ @@ -376,7 +376,7 @@ PHP_METHOD(sundown_markdown, __destruct) { zval *extensions; - extensions = zend_read_property(sundown_markdown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC); + extensions = zend_read_property(sundown_markdown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC); zval_ptr_dtor(&extensions); } /* }}} */ @@ -430,7 +430,7 @@ PHP_METHOD(sundown_markdown, render) sdhtml_renderer(&sundown_render, &opt.html, render_flags); break; case SUNDOWN_RENDER_TOC: - sdhtml_toc_renderer(&sundown_render,&opt.html); + sdhtml_toc_renderer(&sundown_render, &opt.html); break; default: RETURN_FALSE; @@ -453,8 +453,8 @@ PHP_METHOD(sundown_markdown, render) /* preprocess */ MAKE_STD_ZVAL(ret); MAKE_STD_ZVAL(params[0]); - ZVAL_STRINGL(params[0], buffer,strlen(buffer), 1); - ZVAL_STRING(&preprocess,"preprocess",1); + ZVAL_STRINGL(params[0], buffer, strlen(buffer), 1); + ZVAL_STRING(&preprocess, "preprocess", 1); if (call_user_function(NULL, &render, &preprocess, ret, 1, params TSRMLS_CC) == FAILURE) { } @@ -478,7 +478,7 @@ PHP_METHOD(sundown_markdown, render) MAKE_STD_ZVAL(ret); MAKE_STD_ZVAL(params[0]); ZVAL_STRINGL(params[0], (char *)output_buf->data, output_buf->size, 1); - ZVAL_STRING(&postprocess,"postprocess",1); + ZVAL_STRING(&postprocess, "postprocess", 1); if (call_user_function(NULL, &render, &postprocess, ret, 1, params TSRMLS_CC) == FAILURE) { } @@ -510,8 +510,8 @@ PHP_METHOD(sundown_markdown, hasExtension) return; } - if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) { - table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC)); + if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) { + table = Z_ARRVAL_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC)); RETVAL_BOOL(php_sundown_has_ext(table, name)); } } @@ -524,7 +524,7 @@ PHP_METHOD(sundown_markdown, hasRenderFlag) char *name; int name_len = 0; HashTable *table; - zval *render_flags,*render = NULL; + zval *render_flags, *render = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { @@ -553,10 +553,10 @@ PHP_METHOD(sundown_markdown, setExtensions) return; } - tmp = zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC); + tmp = zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC); zval_ptr_dtor(&tmp); - add_property_zval_ex(getThis(),"extensions",sizeof("extensions"),extensions TSRMLS_CC); + add_property_zval_ex(getThis(), "extensions", sizeof("extensions"), extensions TSRMLS_CC); } /* }}} */ @@ -564,10 +564,10 @@ PHP_METHOD(sundown_markdown, setExtensions) */ PHP_METHOD(sundown_markdown, getExtensions) { - if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) { + if (Z_TYPE_P(zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC)) != IS_NULL) { zval *result; - result = zend_read_property(sundown_class_entry, getThis(),"extensions",sizeof("extensions")-1, 0 TSRMLS_CC); + result = zend_read_property(sundown_class_entry, getThis(), "extensions", sizeof("extensions")-1, 0 TSRMLS_CC); RETVAL_ZVAL(result, 1, 0); } } @@ -595,7 +595,7 @@ PHP_METHOD(sundown_markdown, setRender) } if (!instanceof_function_ex(Z_OBJCE_P(render), sundown_render_base_class_entry, 0 TSRMLS_CC)) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,"Render class must extend Sundown\\Render\\Base"); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Render class must extend Sundown\\Render\\Base"); return; } zval_ptr_dtor(&object->render); @@ -615,14 +615,14 @@ static zend_function_entry php_sundown_markdown_methods[] = { PHP_ME(sundown_markdown, setExtensions, arginfo_sundown_markdown_set_extensions, ZEND_ACC_PUBLIC) PHP_ME(sundown_markdown, hasExtension, arginfo_sundown_markdown_has_extension, ZEND_ACC_PUBLIC) PHP_ME(sundown_markdown, hasRenderFlag, arginfo_sundown_markdown_has_render_flag, ZEND_ACC_PUBLIC) - {NULL,NULL,NULL} + {NULL, NULL, NULL} }; void php_sundown_markdown_init(TSRMLS_D) { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "Sundown","Markdown", php_sundown_markdown_methods); + INIT_NS_CLASS_ENTRY(ce, "Sundown", "Markdown", php_sundown_markdown_methods); sundown_markdown_class_entry = zend_register_internal_class(&ce TSRMLS_CC); sundown_markdown_class_entry->create_object = php_sundown_markdown_new; zend_declare_property_null(sundown_markdown_class_entry, "extensions", sizeof("extensions")-1, ZEND_ACC_PUBLIC TSRMLS_CC); From 1f11ace6dcb73b0be3ca62f4ada04a3c3882d58f Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Sat, 11 Aug 2012 02:56:14 +0900 Subject: [PATCH 09/11] update README --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f0a9383..ad98dcb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ PHP + Sundown =========================== -php-sundown is just simple wrapper of . +php-sundown is just simple wrapper of . [![Build Status](https://secure.travis-ci.org/chobie/php-sundown.png)](http://travis-ci.org/chobie/php-sundown) @@ -32,9 +32,8 @@ PHP5.3 higher Install for developpers ----------------------- - git clone https://github.com/chobie/php-sundown.git php-sundown -b development + git clone https://github.com/chobie/php-sundown.git php-sundown --recursive cd php-sundown - git submodule init && git submodule update phpze ./configure make From 9582b044432d60a8673cac4f7c517e488433f483 Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Sat, 11 Aug 2012 02:56:59 +0900 Subject: [PATCH 10/11] update contributors --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ad98dcb..bc46fbe 100644 --- a/README.md +++ b/README.md @@ -264,6 +264,8 @@ documented at [ExtensionsAndRenderFlags.md](https://github.com/chobie/php-sundow Contributors ------------ + * Dominic Scheirlinck -* stealth35 +* Reeze Xia * Shuhei Tanuma +* stealth35 \ No newline at end of file From 0854fddcaeb109c481046642c16d354dca99a4d7 Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Sat, 11 Aug 2012 11:39:30 +0900 Subject: [PATCH 11/11] update package.xml for 0.3.7 release --- package.xml | 67 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/package.xml b/package.xml index c8640b6..8f38a82 100644 --- a/package.xml +++ b/package.xml @@ -15,10 +15,10 @@ PECL Sundown provides straight forward object oriented Markdown API and customiz chobieeee@php.net yes - 2012-06-02 + 2012-08-11 - 0.3.6 - 0.3.6 + 0.3.7 + 0.3.7 beta @@ -26,24 +26,21 @@ PECL Sundown provides straight forward object oriented Markdown API and customiz PHP - * bumped up 0.3.6 - -now, php-sundown is able to use under windows box. -Thank you stealth35! + * bumped up 0.3.7 -* prettify phpinfo, add ext and sundown version -* windows support -* fix several compile warnings - -[removed constants]: -Sundown\Render\LIST_ORDERED -Sundown\Render\MKDA_NORMAL -Sundown\Render\MKDA_EMAIL +fixed SEGV when processing tableCell and prettify source codes. -[added constants]: -Sundown\Render\Base::LIST_ORDERED -Sundown\Render\Base::MKDA_NORMAL -Sundown\Render\Base::MKDA_EMAIL +9582b04 update contributors +1f11ace update README +497d0a4 add a space after comma. +7bc4703 fix several compile warnings +a11eb98 update CFLAGS for fix compile warnings +9a86d00 fixes #26:prevent SEGV when calling Sundwon\Base\tableCell +26b77d6 change submodule to vmg/sundown from tanoku/sundown +ee8a132 Merge pull request #24 from reeze/patch-2 +0a08969 Fix build in php-src +b0adcc7 Merge pull request #23 from reeze/patch-1 +ebae34b Make travis report test failure since make test didn't report exit code @@ -91,6 +88,7 @@ Sundown\Render\Base::MKDA_EMAIL + @@ -135,6 +133,37 @@ Sundown\Render\Base::MKDA_EMAIL sundown + + + beta + beta + + + 0.3.6 + 0.3.6 + + 2012-06-02 + + * bumped up 0.3.6 + +now, php-sundown is able to use under windows box. +Thank you stealth35! + +* prettify phpinfo, add ext and sundown version +* windows support +* fix several compile warnings + +[removed constants]: +Sundown\Render\LIST_ORDERED +Sundown\Render\MKDA_NORMAL +Sundown\Render\MKDA_EMAIL + +[added constants]: +Sundown\Render\Base::LIST_ORDERED +Sundown\Render\Base::MKDA_NORMAL +Sundown\Render\Base::MKDA_EMAIL + + beta