diff --git a/configure.inc b/configure.inc index 5115c86..3744678 100755 --- a/configure.inc +++ b/configure.inc @@ -826,9 +826,7 @@ EOF # AC_C_VOLATILE checks to see if the compiler supports the volatile keyword # AC_C_VOLATILE () { - cat > ngc$$.c << EOF -f() { volatile char me=1; } -EOF + echo 'f() { volatile char me=1; }' > ngc$$.c LOGN "checking for \"volatile\" keyword" if __MAKEDOTO ngc$$.c; then @@ -842,6 +840,23 @@ EOF } +# +# AC_C_INLINE checks to see if compiler supports the inline keyword +# +AC_C_INLINE() { + echo 'inline int foo() { return 1; }' > ngc$$.c + LOGN 'Checking for "inline" keyword' + if __MAKEDOTO ngc$$.c; then + rc=0 + else + AC_DEFINE inline '/**/' + rc=1 + fi + __remove ngc$$.c + return $rc +} + + # # AC_SCALAR_TYPES checks to see if the compiler can generate 2 and 4 byte ints. # diff --git a/configure.sh b/configure.sh index 9f4619f..43ef971 100755 --- a/configure.sh +++ b/configure.sh @@ -72,6 +72,7 @@ AC_PROG ranlib AC_C_VOLATILE AC_C_CONST +AC_C_INLINE AC_SCALAR_TYPES sub hdr AC_CHECK_BASENAME diff --git a/generate.c b/generate.c index 7f0f764..805c001 100644 --- a/generate.c +++ b/generate.c @@ -40,7 +40,7 @@ push(char *bfr, int size, MMIOT *f) /* look characters ahead of the cursor. */ -static int +static inline int peek(MMIOT *f, int i) { @@ -52,7 +52,7 @@ peek(MMIOT *f, int i) /* pull a byte from the input buffer */ -static int +static inline int pull(MMIOT *f) { return ( f->isp < S(f->in) ) ? T(f->in)[f->isp++] : EOF; @@ -61,14 +61,14 @@ pull(MMIOT *f) /* return a pointer to the current position in the input buffer. */ -static char* +static inline char* cursor(MMIOT *f) { return T(f->in) + f->isp; } -static int +static inline int isthisspace(MMIOT *f, int i) { int c = peek(f, i); @@ -77,7 +77,7 @@ isthisspace(MMIOT *f, int i) } -static int +static inline int isthisalnum(MMIOT *f, int i) { int c = peek(f, i); @@ -86,7 +86,7 @@ isthisalnum(MMIOT *f, int i) } -static int +static inline int isthisnonword(MMIOT *f, int i) { return isthisspace(f, i) || ispunct(peek(f,i)); diff --git a/markdown.c b/markdown.c index a88622c..4ace458 100644 --- a/markdown.c +++ b/markdown.c @@ -80,7 +80,7 @@ mkd_firstnonblank(Line *p) } -static int +static inline int blankline(Line *p) { return ! (p && (S(p->text) > p->dle) ); @@ -380,21 +380,21 @@ isfootnote(Line *t) } -static int +static inline int isquote(Line *t) { return (t->dle < 4 && T(t->text)[t->dle] == '>'); } -static int +static inline int iscode(Line *t) { return (t->dle >= 4); } -static int +static inline int ishr(Line *t) { if ( ! (t->flags & CHECKED) ) @@ -444,6 +444,18 @@ ishdr(Line *t, int *htyp) } +static inline int +end_of_block(Line *t) +{ + int dummy; + + if ( !t ) + return 0; + + return ( (S(t->text) <= t->dle) || ishr(t) || ishdr(t, &dummy) ); +} + + static Line* is_discount_dt(Line *t, int *clip) { @@ -477,13 +489,12 @@ static Line* is_extra_dt(Line *t, int *clip) { #if USE_EXTRA_DL - int i; if ( t && t->next && T(t->text)[0] != '=' && T(t->text)[S(t->text)-1] != '=') { Line *x; - if ( iscode(t) || blankline(t) || ishdr(t,&i) || ishr(t) ) + if ( iscode(t) || end_of_block(t) ) return 0; if ( (x = skipempty(t->next)) && is_extra_dd(x) ) { @@ -519,7 +530,7 @@ islist(Line *t, int *clip, DWORD flags, int *list_type) int i, j; char *q; - if ( /*iscode(t) ||*/ blankline(t) || ishdr(t,&i) || ishr(t) ) + if ( end_of_block(t) ) return 0; if ( !(flags & (MKD_NODLIST|MKD_STRICT)) && isdefinition(t,clip,list_type) ) @@ -690,7 +701,7 @@ endoftextblock(Line *t, int toplevelblock, DWORD flags) { int z; - if ( blankline(t)||isquote(t)||ishdr(t,&z)||ishr(t) ) + if ( end_of_block(t) || isquote(t) ) return 1; /* HORRIBLE STANDARDS KLUDGE: non-toplevel paragraphs absorb adjacent