]> granicus.if.org Git - multimarkdown/commitdiff
ADDED: Add stack_sort header
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Sat, 29 Jul 2017 20:55:18 +0000 (16:55 -0400)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Sat, 29 Jul 2017 20:55:18 +0000 (16:55 -0400)
Sources/libMultiMarkdown/stack.c
Sources/libMultiMarkdown/stack.h

index 2887647314a95dc9495d37810df8b1243c6876fc..bae24d62f4f9096c9c055a29554e3f46374130d2 100644 (file)
@@ -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 <stdlib.h>
 #include <string.h>
@@ -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);
+}
+
index 87c7a7c251bc5a46289e4196cfd7c499a5749262..e63b0271ed685508d4c85e56eb848b65fa988109 100644 (file)
@@ -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