From: Fletcher T. Penney Date: Sat, 29 Jul 2017 20:55:18 +0000 (-0400) Subject: ADDED: Add stack_sort header X-Git-Tag: 6.2.0^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=21152c862aca7279b8f4eb9bd04d7dc99b471131;p=multimarkdown ADDED: Add stack_sort header --- diff --git a/Sources/libMultiMarkdown/stack.c b/Sources/libMultiMarkdown/stack.c index 2887647..bae24d6 100644 --- a/Sources/libMultiMarkdown/stack.c +++ b/Sources/libMultiMarkdown/stack.c @@ -10,7 +10,7 @@ @author Fletcher T. Penney @bug -**/ + **/ /* @@ -21,7 +21,7 @@ GLibFacade.c and GLibFacade.h are from the MultiMarkdown v4 project: - https://github.com/fletcher/MultiMarkdown-4/ + https://github.com/fletcher/MultiMarkdown-4/ MMD 4 is released under both the MIT License and GPL. @@ -50,7 +50,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ + */ #include #include @@ -134,3 +134,9 @@ void * stack_peek_index(stack * s, size_t index) { return s->element[index]; } + +/// Sort array using specified compare_function +void stack_sort(stack * s, void * compare_function) { + qsort(s->element, s->size, sizeof(void *), compare_function); +} + diff --git a/Sources/libMultiMarkdown/stack.h b/Sources/libMultiMarkdown/stack.h index 87c7a7c..e63b027 100644 --- a/Sources/libMultiMarkdown/stack.h +++ b/Sources/libMultiMarkdown/stack.h @@ -10,7 +10,7 @@ @author Fletcher T. Penney @bug -**/ + **/ /* @@ -21,7 +21,7 @@ GLibFacade.c and GLibFacade.h are from the MultiMarkdown v4 project: - https://github.com/fletcher/MultiMarkdown-4/ + https://github.com/fletcher/MultiMarkdown-4/ MMD 4 is released under both the MIT License and GPL. @@ -50,7 +50,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ + */ #ifndef STACK_SMART_STRING_H @@ -107,4 +107,7 @@ void * stack_peek_index( ); +/// Sort stack based on sort_function +void stack_sort(stack * s, void * compare_function); + #endif