| 1 |
diff -U7 ext.orig/generate.c ext.new/generate.c |
| 2 |
--- ext.orig/generate.c |
| 3 |
+++ ext.new/generate.c |
| 4 |
@@ -173,24 +173,29 @@ |
| 5 |
char bfr[80]; |
| 6 |
va_list ptr; |
| 7 |
|
| 8 |
va_start(ptr,fmt); |
| 9 |
vsnprintf(bfr, sizeof bfr, fmt, ptr); |
| 10 |
va_end(ptr); |
| 11 |
Qstring(bfr, f); |
| 12 |
+} |
| 13 |
+ |
| 14 |
+ |
| 15 |
+static int Qchar_mkd_sta_function_t(const int n, const void* iot) { |
| 16 |
+ Qchar(n, iot); |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
/* Qanchor() prints out a suitable-for-id-tag version of a string |
| 21 |
*/ |
| 22 |
static void |
| 23 |
Qanchor(struct line *p, MMIOT *f) |
| 24 |
{ |
| 25 |
mkd_string_to_anchor(T(p->text), S(p->text), |
| 26 |
- (mkd_sta_function_t)Qchar, f, 1, f); |
| 27 |
+ Qchar_mkd_sta_function_t, f, 1, f); |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
/* Qem() |
| 32 |
*/ |
| 33 |
static void |
| 34 |
Qem(MMIOT *f, char c, int count) |
| 35 |
@@ -622,16 +627,15 @@ |
| 36 |
} /* printlinkyref */ |
| 37 |
|
| 38 |
|
| 39 |
/* helper function for php markdown extra footnotes; allow the user to |
| 40 |
* define a prefix tag instead of just `fn` |
| 41 |
*/ |
| 42 |
static char * |
| 43 |
-p_or_nothing(p) |
| 44 |
-MMIOT *p; |
| 45 |
+p_or_nothing(MMIOT *p) |
| 46 |
{ |
| 47 |
return p->ref_prefix ? p->ref_prefix : "fn"; |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
/* php markdown extra/daring fireball style print footnotes |
| 52 |
*/ |
| 53 |
diff -U7 ext.orig/gethopt.c ext.new/gethopt.c |
| 54 |
--- ext.orig/gethopt.c |
| 55 |
+++ ext.new/gethopt.c |
| 56 |
@@ -6,64 +6,54 @@ |
| 57 |
#include <stdio.h> |
| 58 |
#include <string.h> |
| 59 |
|
| 60 |
#include "gethopt.h" |
| 61 |
|
| 62 |
|
| 63 |
void |
| 64 |
-hoptset(ctx, argc, argv) |
| 65 |
-struct h_context *ctx; |
| 66 |
-int argc; |
| 67 |
-char **argv; |
| 68 |
+hoptset(struct h_context *ctx, int argc, char **argv) |
| 69 |
{ |
| 70 |
memset(ctx, 0, sizeof *ctx); |
| 71 |
ctx->argc = argc; |
| 72 |
ctx->argv = argv; |
| 73 |
ctx->optind = 1; |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
char * |
| 78 |
-hoptarg(ctx) |
| 79 |
-struct h_context *ctx; |
| 80 |
+hoptarg(struct h_context *ctx) |
| 81 |
{ |
| 82 |
return ctx->optarg; |
| 83 |
} |
| 84 |
|
| 85 |
int |
| 86 |
-hoptind(ctx) |
| 87 |
-struct h_context *ctx; |
| 88 |
+hoptind(struct h_context *ctx) |
| 89 |
{ |
| 90 |
return ctx->optind; |
| 91 |
} |
| 92 |
|
| 93 |
char |
| 94 |
-hoptopt(ctx) |
| 95 |
-struct h_context *ctx; |
| 96 |
+hoptopt(struct h_context *ctx) |
| 97 |
{ |
| 98 |
return ctx->optopt; |
| 99 |
} |
| 100 |
|
| 101 |
|
| 102 |
int |
| 103 |
-hopterr(ctx,val) |
| 104 |
-struct h_context *ctx; |
| 105 |
+hopterr(struct h_context *ctx, int val) |
| 106 |
{ |
| 107 |
int old = ctx->opterr; |
| 108 |
|
| 109 |
ctx->opterr = !!val; |
| 110 |
return old; |
| 111 |
} |
| 112 |
|
| 113 |
|
| 114 |
struct h_opt * |
| 115 |
-gethopt(ctx, opts, nropts) |
| 116 |
-struct h_context *ctx; |
| 117 |
-struct h_opt *opts; |
| 118 |
-int nropts; |
| 119 |
+gethopt(struct h_context *ctx, struct h_opt *opts, int nropts) |
| 120 |
{ |
| 121 |
int i; |
| 122 |
int dashes; |
| 123 |
|
| 124 |
|
| 125 |
if ( (ctx == 0) || ctx->optend || (ctx->optind >= ctx->argc) ) |
| 126 |
return 0; |
| 127 |
diff -U7 ext.orig/toc.c ext.new/toc.c |
| 128 |
--- ext.orig/toc.c |
| 129 |
+++ ext.new/toc.c |
| 130 |
@@ -11,14 +11,19 @@ |
| 131 |
#include <stdlib.h> |
| 132 |
#include <ctype.h> |
| 133 |
|
| 134 |
#include "cstring.h" |
| 135 |
#include "markdown.h" |
| 136 |
#include "amalloc.h" |
| 137 |
|
| 138 |
+static int Csputc_mkd_sta_function_t(const int n, const void* iot) { |
| 139 |
+ Csputc(n, iot); |
| 140 |
+} |
| 141 |
+ |
| 142 |
+ |
| 143 |
/* write an header index |
| 144 |
*/ |
| 145 |
int |
| 146 |
mkd_toc(Document *p, char **doc) |
| 147 |
{ |
| 148 |
Paragraph *tp, *srcp; |
| 149 |
int last_hnumber = 0; |
| 150 |
@@ -60,15 +65,15 @@ |
| 151 |
if ( (srcp->hnumber - last_hnumber) > 1 ) |
| 152 |
Csprintf(&res, "%*s<li>\n", last_hnumber+1, ""); |
| 153 |
++last_hnumber; |
| 154 |
} |
| 155 |
Csprintf(&res, "%*s<li><a href=\"#", srcp->hnumber, ""); |
| 156 |
mkd_string_to_anchor(T(srcp->text->text), |
| 157 |
S(srcp->text->text), |
| 158 |
- (mkd_sta_function_t)Csputc, |
| 159 |
+ Csputc_mkd_sta_function_t, |
| 160 |
&res,1,p->ctx); |
| 161 |
Csprintf(&res, "\">"); |
| 162 |
Csreparse(&res, T(srcp->text->text), |
| 163 |
S(srcp->text->text), IS_LABEL); |
| 164 |
Csprintf(&res, "</a>"); |
| 165 |
|
| 166 |
first = 0; |