From 2b6ea3799e50ffc4aa4365d43ae0dd212b67a398 Mon Sep 17 00:00:00 2001 From: david parsons Date: Sat, 29 Jan 2011 11:00:54 -0800 Subject: [PATCH] create a typedef for the function argument to mkd_string_to_anchor, because some compilers (and by some compilers, I mean "gcc") whine bitterly when you pass a function argument with with a more specific pointer in place of a void*. And if I can't trust the compiler to emit sensible warnings, I'll just cast the damned argument to a type that makes it stfu. In addition, I needed to add prototypes for the html5 tag adder and the two functions that spit out a list of the flags that the code was compiled with. --- generate.c | 6 ++++-- main.c | 6 +++--- markdown.h | 4 +++- mkdio.c | 2 +- mkdio.h.in | 7 ++++++- toc.c | 6 ++++-- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/generate.c b/generate.c index 1c317fa..1c18bc6 100644 --- a/generate.c +++ b/generate.c @@ -1342,7 +1342,9 @@ printheader(Paragraph *pp, MMIOT *f) { if ( f->flags & MKD_TOC ) { Qstring("text->text), S(pp->text->text), Qchar, f, 1); + mkd_string_to_anchor(T(pp->text->text), + S(pp->text->text), + (mkd_sta_function_t)Qchar, f, 1); Qstring("\">\n", f); } Qprintf(f, "", pp->hnumber); @@ -1648,7 +1650,7 @@ display(Paragraph *p, MMIOT *f) static void mkd_extra_footnotes(MMIOT *m) { - int j, i, prefix=0; + int j, i; Footnote *t; if ( m->reference == 0 ) diff --git a/main.c b/main.c index 1d47e9c..049515c 100644 --- a/main.c +++ b/main.c @@ -39,7 +39,7 @@ char *pgm = "markdown"; static struct { char *name; int off; - int flag; + mkd_flag_t flag; } opts[] = { { "tabstop", 0, MKD_TABSTOP }, { "image", 1, MKD_NOIMAGE }, @@ -72,7 +72,7 @@ static struct { void -set(int *flags, char *optionstring) +set(mkd_flag_t *flags, char *optionstring) { int i; int enable; @@ -119,7 +119,7 @@ main(int argc, char **argv) { int opt; int rc; - int flags = 0; + mkd_flag_t flags = 0; int debug = 0; int toc = 0; int version = 0; diff --git a/markdown.h b/markdown.h index 781de55..7e3ca0b 100644 --- a/markdown.h +++ b/markdown.h @@ -149,7 +149,9 @@ extern int mkd_line(char *, int, char **, DWORD); extern int mkd_generateline(char *, int, FILE*, DWORD); #define mkd_text mkd_generateline extern void mkd_basename(Document*, char *); -extern void mkd_string_to_anchor(char*,int, void(*)(int,void*), void*, int); + +typedef int (*mkd_sta_function_t)(const int,const void*); +extern void mkd_string_to_anchor(char*,int, mkd_sta_function_t, void*, int); extern Document *mkd_in(FILE *, DWORD); extern Document *mkd_string(char*,int, DWORD); diff --git a/mkdio.c b/mkdio.c index 13784fd..0af514e 100644 --- a/mkdio.c +++ b/mkdio.c @@ -215,7 +215,7 @@ markdown(Document *document, FILE *out, int flags) /* write out a Cstring, mangled into a form suitable for `hnumber, ""); mkd_string_to_anchor(T(srcp->text->text), - S(srcp->text->text), Csputc, &res,1); + S(srcp->text->text), + (mkd_sta_function_t)Csputc, &res,1); Csprintf(&res, "\">"); mkd_string_to_anchor(T(srcp->text->text), - S(srcp->text->text), Csputc, &res,0); + S(srcp->text->text), + (mkd_sta_function_t)Csputc, &res,0); Csprintf(&res, ""); Csprintf(&res, "\n"); }