From: Fletcher T. Penney Date: Mon, 7 Jan 2019 14:33:18 +0000 (-0500) Subject: UPDATED: Update astyle settings X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bf1a19f69a173fe98efc102c26347ae58d217ee9;p=multimarkdown UPDATED: Update astyle settings --- diff --git a/.astylerc b/.astylerc index 0ff809f..4db6063 100644 --- a/.astylerc +++ b/.astylerc @@ -21,7 +21,7 @@ # Indent pre-processor directives --indent-preproc-block --indent-preproc-define ---indent-preproc-cond +#--indent-preproc-cond # Line endings diff --git a/Sources/libMultiMarkdown/aho-corasick.c b/Sources/libMultiMarkdown/aho-corasick.c index a996380..90cd8bc 100644 --- a/Sources/libMultiMarkdown/aho-corasick.c +++ b/Sources/libMultiMarkdown/aho-corasick.c @@ -478,9 +478,9 @@ void match_set_filter_leftmost_longest(match * header) { m->next->start > m->start && m->next->start < m->start + m->len) { // This match is "lefter" than next - #ifndef __clang_analyzer__ +#ifndef __clang_analyzer__ match_excise(m->next); - #endif +#endif } while (m->next && @@ -497,9 +497,9 @@ void match_set_filter_leftmost_longest(match * header) { m->prev->start >= m->start) { // We are "lefter" than previous n = m->prev; - #ifndef __clang_analyzer__ +#ifndef __clang_analyzer__ match_excise(n); - #endif +#endif } m = m->next; diff --git a/Sources/libMultiMarkdown/char_lookup.c b/Sources/libMultiMarkdown/char_lookup.c index fc5c10e..dc96044 100644 --- a/Sources/libMultiMarkdown/char_lookup.c +++ b/Sources/libMultiMarkdown/char_lookup.c @@ -139,7 +139,7 @@ int main( int argc, char** argv ) { // Extended ASCII - #ifdef USE_EXTENDED_ASCII +#ifdef USE_EXTENDED_ASCII // Punctuation ranges for (int i = 132; i < 138; ++i) { @@ -198,7 +198,7 @@ int main( int argc, char** argv ) { } } - #endif +#endif // Print output as 16 x 16 table diff --git a/Sources/libMultiMarkdown/critic_markup.c b/Sources/libMultiMarkdown/critic_markup.c index 0ad27c5..3f14be1 100644 --- a/Sources/libMultiMarkdown/critic_markup.c +++ b/Sources/libMultiMarkdown/critic_markup.c @@ -347,9 +347,9 @@ void mmd_critic_markup_reject(DString * d) { #ifdef TEST void Test_critic(CuTest* tc) { - #ifdef kUseObjectPool +#ifdef kUseObjectPool token_pool_init(); - #endif +#endif DString * test = d_string_new("{--foo bar--}"); mmd_critic_markup_reject(test); @@ -416,11 +416,11 @@ void Test_critic(CuTest* tc) { mmd_critic_markup_reject(test); CuAssertStrEquals(tc, "", test->str); - #ifdef kUseObjectPool +#ifdef kUseObjectPool // Decrement counter and clean up token pool token_pool_drain(); token_pool_free(); - #endif +#endif } #endif diff --git a/Sources/libMultiMarkdown/d_string.c b/Sources/libMultiMarkdown/d_string.c index 4779f0f..efbcc95 100644 --- a/Sources/libMultiMarkdown/d_string.c +++ b/Sources/libMultiMarkdown/d_string.c @@ -89,13 +89,13 @@ int vasprintf(char** strp, const char* fmt, va_list ap) { va_list ap2; va_copy(ap2, ap); - #if (defined(_WIN32) || defined(__WIN32__)) +#if (defined(_WIN32) || defined(__WIN32__)) char *tmp = NULL; int size = vsnprintf(tmp, 0, fmt, ap2); - #else +#else char tmp[1]; int size = vsnprintf(tmp, 1, fmt, ap2); - #endif +#endif if (size <= 0) { return size; diff --git a/Sources/libMultiMarkdown/file.c b/Sources/libMultiMarkdown/file.c index 406b1f0..59dc736 100644 --- a/Sources/libMultiMarkdown/file.c +++ b/Sources/libMultiMarkdown/file.c @@ -126,16 +126,16 @@ DString * scan_file(const char * fname) { FILE * file; - #if defined(__WIN32) +#if defined(__WIN32) int wchars_num = MultiByteToWideChar(CP_UTF8, 0, fname, -1, NULL, 0); wchar_t wstr[wchars_num]; MultiByteToWideChar(CP_UTF8, 0, fname, -1, wstr, wchars_num); if ((file = _wfopen(wstr, L"rb")) == NULL) { - #else +#else if ((file = fopen(fname, "r")) == NULL ) { - #endif +#endif return NULL; } @@ -182,11 +182,11 @@ DString * stdin_buffer(void) { /// Windows can use either `\` or `/` as a separator -- thanks to t-beckmann on github /// for suggesting a fix for this. bool is_separator(char c) { - #if defined(__WIN32) +#if defined(__WIN32) return c == '\\' || c == '/'; - #else +#else return c == '/'; - #endif +#endif } @@ -194,26 +194,26 @@ bool is_separator(char c) { void Test_is_separator(CuTest* tc) { char * test = "a/\\"; - #if defined(__WIN32) +#if defined(__WIN32) CuAssertIntEquals(tc, false, is_separator(test[0])); CuAssertIntEquals(tc, true, is_separator(test[1])); CuAssertIntEquals(tc, true, is_separator(test[2])); - #else +#else CuAssertIntEquals(tc, false, is_separator(test[0])); CuAssertIntEquals(tc, true, is_separator(test[1])); CuAssertIntEquals(tc, false, is_separator(test[2])); - #endif +#endif } #endif /// Ensure that path ends in separator void add_trailing_sep(DString * path) { - #if defined(__WIN32) +#if defined(__WIN32) char sep = '\\'; - #else +#else char sep = '/'; - #endif +#endif // Ensure that folder ends in separator if ((path->currentStringLength == 0) || (!is_separator(path->str[path->currentStringLength - 1]))) { @@ -307,11 +307,11 @@ void Test_path_from_dir_base(CuTest* tc) { char * path = path_from_dir_base(dir, base); - #if defined(__WIN32) +#if defined(__WIN32) CuAssertStrEquals(tc, "/foo\\bar", path); - #else +#else CuAssertStrEquals(tc, "/foo/bar", path); - #endif +#endif free(path); strcpy(base, "/bar"); @@ -334,11 +334,11 @@ void Test_path_from_dir_base(CuTest* tc) { void split_path_file(char ** dir, char ** file, const char * path) { const char * slash = path, * next; - #if defined(__WIN32) +#if defined(__WIN32) const char sep[] = "\\/"; // Windows allows either variant - #else +#else const char sep[] = "/"; - #endif +#endif while ((next = strpbrk(slash + 1, sep))) { slash = next; @@ -371,13 +371,13 @@ void Test_split_path_file(CuTest* tc) { path = "\\foo\\bar.txt"; split_path_file(&dir, &file, path); - #if defined(__WIN32) +#if defined(__WIN32) CuAssertStrEquals(tc, "\\foo\\", dir); CuAssertStrEquals(tc, "bar.txt", file); - #else +#else CuAssertStrEquals(tc, "", dir); CuAssertStrEquals(tc, "\\foo\\bar.txt", file); - #endif +#endif } #endif @@ -421,15 +421,15 @@ char *realpath(const char *path, char *resolved_path) { // Convert argument to absolute path char * absolute_path_for_argument(const char * arg) { char * result = NULL; - #ifdef PATH_MAX +#ifdef PATH_MAX // If PATH_MAX defined, use it char absolute[PATH_MAX + 1]; realpath(arg, absolute); result = my_strdup(absolute); - #else +#else // If undefined, then we *should* be able to use a NULL pointer to allocate result = realpath(arg, NULL); - #endif +#endif return result; } diff --git a/Sources/libMultiMarkdown/itmz-parser.c b/Sources/libMultiMarkdown/itmz-parser.c index 7e1ec5f..8533b4f 100644 --- a/Sources/libMultiMarkdown/itmz-parser.c +++ b/Sources/libMultiMarkdown/itmz-parser.c @@ -275,20 +275,20 @@ typedef struct yyStackEntry yyStackEntry; ** the following structure */ struct yyParser { yyStackEntry *yytos; /* Pointer to top element of the stack */ - #ifdef YYTRACKMAXSTACKDEPTH +#ifdef YYTRACKMAXSTACKDEPTH int yyhwm; /* High-water mark of the stack */ - #endif - #ifndef YYNOERRORRECOVERY +#endif +#ifndef YYNOERRORRECOVERY int yyerrcnt; /* Shifts left before out of the error */ - #endif +#endif ITMZARG_SDECL /* A place to hold %extra_argument */ - #if YYSTACKDEPTH<=0 +#if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ yyStackEntry yystk0; /* First stack entry */ - #else +#else yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ - #endif +#endif }; typedef struct yyParser yyParser; @@ -390,14 +390,14 @@ static int yyGrowStack(yyParser *p) { if ( pNew ) { p->yystack = pNew; p->yytos = &p->yystack[idx]; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sStack grows from %d to %d entries.\n", yyTracePrompt, p->yystksz, newSize); } - #endif +#endif p->yystksz = newSize; } @@ -431,10 +431,10 @@ void *ITMZAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)) { pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); if ( pParser ) { - #ifdef YYTRACKMAXSTACKDEPTH +#ifdef YYTRACKMAXSTACKDEPTH pParser->yyhwm = 0; - #endif - #if YYSTACKDEPTH<=0 +#endif +#if YYSTACKDEPTH<=0 pParser->yytos = NULL; pParser->yystack = NULL; pParser->yystksz = 0; @@ -444,10 +444,10 @@ void *ITMZAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)) { pParser->yystksz = 1; } - #endif - #ifndef YYNOERRORRECOVERY +#endif +#ifndef YYNOERRORRECOVERY pParser->yyerrcnt = -1; - #endif +#endif pParser->yytos = pParser->yystack; pParser->yystack[0].stateno = 0; pParser->yystack[0].major = 0; @@ -499,7 +499,7 @@ static void yy_pop_parser_stack(yyParser *pParser) { assert( pParser->yytos != 0 ); assert( pParser->yytos > pParser->yystack ); yytos = pParser->yytos--; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sPopping %s\n", @@ -507,7 +507,7 @@ static void yy_pop_parser_stack(yyParser *pParser) { yyTokenName[yytos->major]); } - #endif +#endif yy_destructor(pParser, yytos->major, &yytos->minor); } @@ -524,25 +524,25 @@ void ITMZFree( void (*freeProc)(void*) /* Function used to reclaim memory */ ) { yyParser *pParser = (yyParser*)p; - #ifndef YYPARSEFREENEVERNULL +#ifndef YYPARSEFREENEVERNULL if ( pParser == 0 ) { return; } - #endif +#endif while ( pParser->yytos > pParser->yystack ) { yy_pop_parser_stack(pParser); } - #if YYSTACKDEPTH<=0 +#if YYSTACKDEPTH<=0 if ( pParser->yystack != &pParser->yystk0 ) { free(pParser->yystack); } - #endif +#endif (*freeProc)((void*)pParser); } @@ -579,39 +579,39 @@ static unsigned int yy_find_shift_action( i += iLookAhead; if ( i < 0 || i >= YY_ACTTAB_COUNT || yy_lookahead[i] != iLookAhead ) { - #ifdef YYFALLBACK +#ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ if ( iLookAhead < sizeof(yyFallback) / sizeof(yyFallback[0]) && (iFallback = yyFallback[iLookAhead]) != 0 ) { - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n", yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); } - #endif +#endif assert( yyFallback[iFallback] == 0 ); /* Fallback loop must terminate */ iLookAhead = iFallback; continue; } - #endif - #ifdef YYWILDCARD +#endif +#ifdef YYWILDCARD { int j = i - iLookAhead + YYWILDCARD; if ( - #if YY_SHIFT_MIN+YYWILDCARD<0 +#if YY_SHIFT_MIN+YYWILDCARD<0 j >= 0 && - #endif - #if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT +#endif +#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT j < YY_ACTTAB_COUNT && - #endif +#endif yy_lookahead[j] == YYWILDCARD && iLookAhead > 0 ) { - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", @@ -619,11 +619,11 @@ static unsigned int yy_find_shift_action( yyTokenName[YYWILDCARD]); } - #endif /* NDEBUG */ +#endif /* NDEBUG */ return yy_action[j]; } } - #endif /* YYWILDCARD */ +#endif /* YYWILDCARD */ return yy_default[stateno]; } else { return yy_action[i]; @@ -640,29 +640,29 @@ static int yy_find_reduce_action( YYCODETYPE iLookAhead /* The look-ahead token */ ) { int i; - #ifdef YYERRORSYMBOL +#ifdef YYERRORSYMBOL if ( stateno > YY_REDUCE_COUNT ) { return yy_default[stateno]; } - #else +#else assert( stateno <= YY_REDUCE_COUNT ); - #endif +#endif i = yy_reduce_ofst[stateno]; assert( i != YY_REDUCE_USE_DFLT ); assert( iLookAhead != YYNOCODE ); i += iLookAhead; - #ifdef YYERRORSYMBOL +#ifdef YYERRORSYMBOL if ( i < 0 || i >= YY_ACTTAB_COUNT || yy_lookahead[i] != iLookAhead ) { return yy_default[stateno]; } - #else +#else assert( i >= 0 && i < YY_ACTTAB_COUNT ); assert( yy_lookahead[i] == iLookAhead ); - #endif +#endif return yy_action[i]; } @@ -672,13 +672,13 @@ static int yy_find_reduce_action( static void yyStackOverflow(yyParser *yypParser) { ITMZARG_FETCH; yypParser->yytos--; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sStack Overflow!\n", yyTracePrompt); } - #endif +#endif while ( yypParser->yytos > yypParser->yystack ) { yy_pop_parser_stack(yypParser); @@ -722,22 +722,22 @@ static void yy_shift( ) { yyStackEntry *yytos; yypParser->yytos++; - #ifdef YYTRACKMAXSTACKDEPTH +#ifdef YYTRACKMAXSTACKDEPTH if ( (int)(yypParser->yytos - yypParser->yystack) > yypParser->yyhwm ) { yypParser->yyhwm++; assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); } - #endif - #if YYSTACKDEPTH>0 +#endif +#if YYSTACKDEPTH>0 if ( yypParser->yytos >= &yypParser->yystack[YYSTACKDEPTH] ) { yyStackOverflow(yypParser); return; } - #else +#else if ( yypParser->yytos >= &yypParser->yystack[yypParser->yystksz] ) { if ( yyGrowStack(yypParser) ) { @@ -746,7 +746,7 @@ static void yy_shift( } } - #endif +#endif if ( yyNewState > YY_MAX_SHIFT ) { yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; @@ -800,7 +800,7 @@ static void yy_reduce( int yysize; /* Amount to pop the stack */ ITMZARG_FETCH; yymsp = yypParser->yytos; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE && yyruleno < (int)(sizeof(yyRuleName) / sizeof(yyRuleName[0])) ) { yysize = yyRuleInfo[yyruleno].nrhs; @@ -808,28 +808,28 @@ static void yy_reduce( yyRuleName[yyruleno], yymsp[-yysize].stateno); } - #endif /* NDEBUG */ +#endif /* NDEBUG */ /* Check that the stack is large enough to grow by a single entry ** if the RHS of the rule is empty. This ensures that there is room ** enough on the stack to push the LHS value */ if ( yyRuleInfo[yyruleno].nrhs == 0 ) { - #ifdef YYTRACKMAXSTACKDEPTH +#ifdef YYTRACKMAXSTACKDEPTH if ( (int)(yypParser->yytos - yypParser->yystack) > yypParser->yyhwm ) { yypParser->yyhwm++; assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); } - #endif - #if YYSTACKDEPTH>0 +#endif +#if YYSTACKDEPTH>0 if ( yypParser->yytos >= &yypParser->yystack[YYSTACKDEPTH - 1] ) { yyStackOverflow(yypParser); return; } - #else +#else if ( yypParser->yytos >= &yypParser->yystack[yypParser->yystksz - 1] ) { if ( yyGrowStack(yypParser) ) { @@ -840,7 +840,7 @@ static void yy_reduce( yymsp = yypParser->yytos; } - #endif +#endif } switch ( yyruleno ) { @@ -912,13 +912,13 @@ static void yy_parse_failed( yyParser *yypParser /* The parser */ ) { ITMZARG_FETCH; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sFail!\n", yyTracePrompt); } - #endif +#endif while ( yypParser->yytos > yypParser->yystack ) { yy_pop_parser_stack(yypParser); @@ -947,7 +947,7 @@ static void yy_syntax_error( /************ Begin %syntax_error code ****************************************/ fprintf(stderr, "Parser syntax error.\n"); - #ifndef NDEBUG +#ifndef NDEBUG fprintf(stderr, "Parser syntax error.\n"); int n = sizeof(yyTokenName) / sizeof(yyTokenName[0]); @@ -959,7 +959,7 @@ static void yy_syntax_error( } } - #endif +#endif /************ End %syntax_error code ******************************************/ ITMZARG_STORE; /* Suppress warning about unused %extra_argument variable */ } @@ -971,16 +971,16 @@ static void yy_accept( yyParser *yypParser /* The parser */ ) { ITMZARG_FETCH; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sAccept!\n", yyTracePrompt); } - #endif - #ifndef YYNOERRORRECOVERY +#endif +#ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; - #endif +#endif assert( yypParser->yytos == yypParser->yystack ); /* Here code is inserted which will be executed whenever the ** parser accepts */ @@ -1018,54 +1018,54 @@ void ITMZ( ) { YYMINORTYPE yyminorunion; unsigned int yyact; /* The parser action. */ - #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) int yyendofinput; /* True if we are at the end of input */ - #endif - #ifdef YYERRORSYMBOL +#endif +#ifdef YYERRORSYMBOL int yyerrorhit = 0; /* True if yymajor has invoked an error */ - #endif +#endif yyParser *yypParser; /* The parser */ yypParser = (yyParser*)yyp; assert( yypParser->yytos != 0 ); - #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor == 0); - #endif +#endif ITMZARG_STORE; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sInput '%s'\n", yyTracePrompt, yyTokenName[yymajor]); } - #endif +#endif do { yyact = yy_find_shift_action(yypParser, (YYCODETYPE)yymajor); if ( yyact <= YY_MAX_SHIFTREDUCE ) { yy_shift(yypParser, yyact, yymajor, yyminor); - #ifndef YYNOERRORRECOVERY +#ifndef YYNOERRORRECOVERY yypParser->yyerrcnt--; - #endif +#endif yymajor = YYNOCODE; } else if ( yyact <= YY_MAX_REDUCE ) { yy_reduce(yypParser, yyact - YY_MIN_REDUCE); } else { assert( yyact == YY_ERROR_ACTION ); yyminorunion.yy0 = yyminor; - #ifdef YYERRORSYMBOL +#ifdef YYERRORSYMBOL int yymx; - #endif - #ifndef NDEBUG +#endif +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sSyntax Error!\n", yyTracePrompt); } - #endif - #ifdef YYERRORSYMBOL +#endif +#ifdef YYERRORSYMBOL /* A syntax error has occurred. ** The response to an error depends upon whether or not the @@ -1093,14 +1093,14 @@ void ITMZ( yymx = yypParser->yytos->major; if ( yymx == YYERRORSYMBOL || yyerrorhit ) { - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sDiscard input token %s\n", yyTracePrompt, yyTokenName[yymajor]); } - #endif +#endif yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; } else { @@ -1116,9 +1116,9 @@ void ITMZ( if ( yypParser->yytos < yypParser->yystack || yymajor == 0 ) { yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yy_parse_failed(yypParser); - #ifndef YYNOERRORRECOVERY +#ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; - #endif +#endif yymajor = YYNOCODE; } else if ( yymx != YYERRORSYMBOL ) { yy_shift(yypParser, yyact, YYERRORSYMBOL, yyminor); @@ -1127,7 +1127,7 @@ void ITMZ( yypParser->yyerrcnt = 3; yyerrorhit = 1; - #elif defined(YYNOERRORRECOVERY) +#elif defined(YYNOERRORRECOVERY) /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax ** error routine and continue going as if nothing had happened. @@ -1139,7 +1139,7 @@ void ITMZ( yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; - #else /* YYERRORSYMBOL is not defined */ +#else /* YYERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** @@ -1159,17 +1159,17 @@ void ITMZ( if ( yyendofinput ) { yy_parse_failed(yypParser); - #ifndef YYNOERRORRECOVERY +#ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; - #endif +#endif } yymajor = YYNOCODE; - #endif +#endif } } while ( yymajor != YYNOCODE && yypParser->yytos > yypParser->yystack ); - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { yyStackEntry *i; @@ -1184,6 +1184,6 @@ void ITMZ( fprintf(yyTraceFILE, "]\n"); } - #endif +#endif return; } diff --git a/Sources/libMultiMarkdown/itmz-reader.c b/Sources/libMultiMarkdown/itmz-reader.c index 69561ba..8ac08d6 100644 --- a/Sources/libMultiMarkdown/itmz-reader.c +++ b/Sources/libMultiMarkdown/itmz-reader.c @@ -196,9 +196,9 @@ void parse_itmz_token_chain(mmd_engine * e, token * chain) { token * walker = chain->next; // Walk the existing tree token * remainder; // Hold unparsed tail of chain - #ifndef NDEBUG +#ifndef NDEBUG ITMZTrace(stderr, "parser >>"); - #endif +#endif // Remove existing token tree e->root = NULL; @@ -212,9 +212,9 @@ void parse_itmz_token_chain(mmd_engine * e, token * chain) { } // Signal finish to parser - #ifndef NDEBUG +#ifndef NDEBUG fprintf(stderr, "\nFinish parse\n"); - #endif +#endif ITMZ(pParser, 0, NULL, e); if (e->root) { diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index 874bbc0..6c39c6b 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -1141,9 +1141,9 @@ void mmd_parse_token_chain(mmd_engine * e, token * chain) { token * walker = chain->child; // Walk the existing tree token * remainder; // Hold unparsed tail of chain - #ifndef NDEBUG +#ifndef NDEBUG ParseTrace(stderr, "parser >>"); - #endif +#endif // Remove existing token tree e->root = NULL; @@ -1159,9 +1159,9 @@ void mmd_parse_token_chain(mmd_engine * e, token * chain) { remainder->prev = NULL; } - #ifndef NDEBUG +#ifndef NDEBUG fprintf(stderr, "\nNew line\n"); - #endif +#endif Parse(pParser, walker->type, walker, e); @@ -1169,9 +1169,9 @@ void mmd_parse_token_chain(mmd_engine * e, token * chain) { } // Signal finish to parser - #ifndef NDEBUG +#ifndef NDEBUG fprintf(stderr, "\nFinish parse\n"); - #endif +#endif Parse(pParser, 0, NULL, e); // Disconnect of (now empty) root @@ -2020,10 +2020,10 @@ void strip_line_tokens_from_block(mmd_engine * e, token * block) { return; } - #ifndef NDEBUG +#ifndef NDEBUG fprintf(stderr, "Strip line tokens from %d (%lu:%lu) (child %d)\n", block->type, block->start, block->len, block->child->type); token_tree_describe(block, e->dstr->str); - #endif +#endif token * l = block->child; @@ -2249,9 +2249,9 @@ token * mmd_engine_parse_substring(mmd_engine * e, size_t byte_start, size_t byt pair_emphasis_tokens(doc); - #ifndef NDEBUG +#ifndef NDEBUG token_tree_describe(doc, e->dstr->str); - #endif +#endif } // Return original extensions diff --git a/Sources/libMultiMarkdown/opml-parser.c b/Sources/libMultiMarkdown/opml-parser.c index 427204a..410b6d1 100644 --- a/Sources/libMultiMarkdown/opml-parser.c +++ b/Sources/libMultiMarkdown/opml-parser.c @@ -274,20 +274,20 @@ typedef struct yyStackEntry yyStackEntry; ** the following structure */ struct yyParser { yyStackEntry *yytos; /* Pointer to top element of the stack */ - #ifdef YYTRACKMAXSTACKDEPTH +#ifdef YYTRACKMAXSTACKDEPTH int yyhwm; /* High-water mark of the stack */ - #endif - #ifndef YYNOERRORRECOVERY +#endif +#ifndef YYNOERRORRECOVERY int yyerrcnt; /* Shifts left before out of the error */ - #endif +#endif OPMLARG_SDECL /* A place to hold %extra_argument */ - #if YYSTACKDEPTH<=0 +#if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ yyStackEntry yystk0; /* First stack entry */ - #else +#else yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ - #endif +#endif }; typedef struct yyParser yyParser; @@ -394,14 +394,14 @@ static int yyGrowStack(yyParser *p) { if ( pNew ) { p->yystack = pNew; p->yytos = &p->yystack[idx]; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sStack grows from %d to %d entries.\n", yyTracePrompt, p->yystksz, newSize); } - #endif +#endif p->yystksz = newSize; } @@ -435,10 +435,10 @@ void *OPMLAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)) { pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); if ( pParser ) { - #ifdef YYTRACKMAXSTACKDEPTH +#ifdef YYTRACKMAXSTACKDEPTH pParser->yyhwm = 0; - #endif - #if YYSTACKDEPTH<=0 +#endif +#if YYSTACKDEPTH<=0 pParser->yytos = NULL; pParser->yystack = NULL; pParser->yystksz = 0; @@ -448,10 +448,10 @@ void *OPMLAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)) { pParser->yystksz = 1; } - #endif - #ifndef YYNOERRORRECOVERY +#endif +#ifndef YYNOERRORRECOVERY pParser->yyerrcnt = -1; - #endif +#endif pParser->yytos = pParser->yystack; pParser->yystack[0].stateno = 0; pParser->yystack[0].major = 0; @@ -503,7 +503,7 @@ static void yy_pop_parser_stack(yyParser *pParser) { assert( pParser->yytos != 0 ); assert( pParser->yytos > pParser->yystack ); yytos = pParser->yytos--; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sPopping %s\n", @@ -511,7 +511,7 @@ static void yy_pop_parser_stack(yyParser *pParser) { yyTokenName[yytos->major]); } - #endif +#endif yy_destructor(pParser, yytos->major, &yytos->minor); } @@ -528,25 +528,25 @@ void OPMLFree( void (*freeProc)(void*) /* Function used to reclaim memory */ ) { yyParser *pParser = (yyParser*)p; - #ifndef YYPARSEFREENEVERNULL +#ifndef YYPARSEFREENEVERNULL if ( pParser == 0 ) { return; } - #endif +#endif while ( pParser->yytos > pParser->yystack ) { yy_pop_parser_stack(pParser); } - #if YYSTACKDEPTH<=0 +#if YYSTACKDEPTH<=0 if ( pParser->yystack != &pParser->yystk0 ) { free(pParser->yystack); } - #endif +#endif (*freeProc)((void*)pParser); } @@ -583,39 +583,39 @@ static unsigned int yy_find_shift_action( i += iLookAhead; if ( i < 0 || i >= YY_ACTTAB_COUNT || yy_lookahead[i] != iLookAhead ) { - #ifdef YYFALLBACK +#ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ if ( iLookAhead < sizeof(yyFallback) / sizeof(yyFallback[0]) && (iFallback = yyFallback[iLookAhead]) != 0 ) { - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n", yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); } - #endif +#endif assert( yyFallback[iFallback] == 0 ); /* Fallback loop must terminate */ iLookAhead = iFallback; continue; } - #endif - #ifdef YYWILDCARD +#endif +#ifdef YYWILDCARD { int j = i - iLookAhead + YYWILDCARD; if ( - #if YY_SHIFT_MIN+YYWILDCARD<0 +#if YY_SHIFT_MIN+YYWILDCARD<0 j >= 0 && - #endif - #if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT +#endif +#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT j < YY_ACTTAB_COUNT && - #endif +#endif yy_lookahead[j] == YYWILDCARD && iLookAhead > 0 ) { - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", @@ -623,11 +623,11 @@ static unsigned int yy_find_shift_action( yyTokenName[YYWILDCARD]); } - #endif /* NDEBUG */ +#endif /* NDEBUG */ return yy_action[j]; } } - #endif /* YYWILDCARD */ +#endif /* YYWILDCARD */ return yy_default[stateno]; } else { return yy_action[i]; @@ -644,29 +644,29 @@ static int yy_find_reduce_action( YYCODETYPE iLookAhead /* The look-ahead token */ ) { int i; - #ifdef YYERRORSYMBOL +#ifdef YYERRORSYMBOL if ( stateno > YY_REDUCE_COUNT ) { return yy_default[stateno]; } - #else +#else assert( stateno <= YY_REDUCE_COUNT ); - #endif +#endif i = yy_reduce_ofst[stateno]; assert( i != YY_REDUCE_USE_DFLT ); assert( iLookAhead != YYNOCODE ); i += iLookAhead; - #ifdef YYERRORSYMBOL +#ifdef YYERRORSYMBOL if ( i < 0 || i >= YY_ACTTAB_COUNT || yy_lookahead[i] != iLookAhead ) { return yy_default[stateno]; } - #else +#else assert( i >= 0 && i < YY_ACTTAB_COUNT ); assert( yy_lookahead[i] == iLookAhead ); - #endif +#endif return yy_action[i]; } @@ -676,13 +676,13 @@ static int yy_find_reduce_action( static void yyStackOverflow(yyParser *yypParser) { OPMLARG_FETCH; yypParser->yytos--; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sStack Overflow!\n", yyTracePrompt); } - #endif +#endif while ( yypParser->yytos > yypParser->yystack ) { yy_pop_parser_stack(yypParser); @@ -726,22 +726,22 @@ static void yy_shift( ) { yyStackEntry *yytos; yypParser->yytos++; - #ifdef YYTRACKMAXSTACKDEPTH +#ifdef YYTRACKMAXSTACKDEPTH if ( (int)(yypParser->yytos - yypParser->yystack) > yypParser->yyhwm ) { yypParser->yyhwm++; assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); } - #endif - #if YYSTACKDEPTH>0 +#endif +#if YYSTACKDEPTH>0 if ( yypParser->yytos >= &yypParser->yystack[YYSTACKDEPTH] ) { yyStackOverflow(yypParser); return; } - #else +#else if ( yypParser->yytos >= &yypParser->yystack[yypParser->yystksz] ) { if ( yyGrowStack(yypParser) ) { @@ -750,7 +750,7 @@ static void yy_shift( } } - #endif +#endif if ( yyNewState > YY_MAX_SHIFT ) { yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; @@ -807,7 +807,7 @@ static void yy_reduce( int yysize; /* Amount to pop the stack */ OPMLARG_FETCH; yymsp = yypParser->yytos; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE && yyruleno < (int)(sizeof(yyRuleName) / sizeof(yyRuleName[0])) ) { yysize = yyRuleInfo[yyruleno].nrhs; @@ -815,28 +815,28 @@ static void yy_reduce( yyRuleName[yyruleno], yymsp[-yysize].stateno); } - #endif /* NDEBUG */ +#endif /* NDEBUG */ /* Check that the stack is large enough to grow by a single entry ** if the RHS of the rule is empty. This ensures that there is room ** enough on the stack to push the LHS value */ if ( yyRuleInfo[yyruleno].nrhs == 0 ) { - #ifdef YYTRACKMAXSTACKDEPTH +#ifdef YYTRACKMAXSTACKDEPTH if ( (int)(yypParser->yytos - yypParser->yystack) > yypParser->yyhwm ) { yypParser->yyhwm++; assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); } - #endif - #if YYSTACKDEPTH>0 +#endif +#if YYSTACKDEPTH>0 if ( yypParser->yytos >= &yypParser->yystack[YYSTACKDEPTH - 1] ) { yyStackOverflow(yypParser); return; } - #else +#else if ( yypParser->yytos >= &yypParser->yystack[yypParser->yystksz - 1] ) { if ( yyGrowStack(yypParser) ) { @@ -847,7 +847,7 @@ static void yy_reduce( yymsp = yypParser->yytos; } - #endif +#endif } switch ( yyruleno ) { @@ -922,13 +922,13 @@ static void yy_parse_failed( yyParser *yypParser /* The parser */ ) { OPMLARG_FETCH; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sFail!\n", yyTracePrompt); } - #endif +#endif while ( yypParser->yytos > yypParser->yystack ) { yy_pop_parser_stack(yypParser); @@ -957,7 +957,7 @@ static void yy_syntax_error( /************ Begin %syntax_error code ****************************************/ fprintf(stderr, "Parser syntax error.\n"); - #ifndef NDEBUG +#ifndef NDEBUG fprintf(stderr, "Parser syntax error.\n"); int n = sizeof(yyTokenName) / sizeof(yyTokenName[0]); @@ -969,7 +969,7 @@ static void yy_syntax_error( } } - #endif +#endif /************ End %syntax_error code ******************************************/ OPMLARG_STORE; /* Suppress warning about unused %extra_argument variable */ } @@ -981,16 +981,16 @@ static void yy_accept( yyParser *yypParser /* The parser */ ) { OPMLARG_FETCH; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sAccept!\n", yyTracePrompt); } - #endif - #ifndef YYNOERRORRECOVERY +#endif +#ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; - #endif +#endif assert( yypParser->yytos == yypParser->yystack ); /* Here code is inserted which will be executed whenever the ** parser accepts */ @@ -1028,54 +1028,54 @@ void OPML( ) { YYMINORTYPE yyminorunion; unsigned int yyact; /* The parser action. */ - #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) int yyendofinput; /* True if we are at the end of input */ - #endif - #ifdef YYERRORSYMBOL +#endif +#ifdef YYERRORSYMBOL int yyerrorhit = 0; /* True if yymajor has invoked an error */ - #endif +#endif yyParser *yypParser; /* The parser */ yypParser = (yyParser*)yyp; assert( yypParser->yytos != 0 ); - #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor == 0); - #endif +#endif OPMLARG_STORE; - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sInput '%s'\n", yyTracePrompt, yyTokenName[yymajor]); } - #endif +#endif do { yyact = yy_find_shift_action(yypParser, (YYCODETYPE)yymajor); if ( yyact <= YY_MAX_SHIFTREDUCE ) { yy_shift(yypParser, yyact, yymajor, yyminor); - #ifndef YYNOERRORRECOVERY +#ifndef YYNOERRORRECOVERY yypParser->yyerrcnt--; - #endif +#endif yymajor = YYNOCODE; } else if ( yyact <= YY_MAX_REDUCE ) { yy_reduce(yypParser, yyact - YY_MIN_REDUCE); } else { assert( yyact == YY_ERROR_ACTION ); yyminorunion.yy0 = yyminor; - #ifdef YYERRORSYMBOL +#ifdef YYERRORSYMBOL int yymx; - #endif - #ifndef NDEBUG +#endif +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sSyntax Error!\n", yyTracePrompt); } - #endif - #ifdef YYERRORSYMBOL +#endif +#ifdef YYERRORSYMBOL /* A syntax error has occurred. ** The response to an error depends upon whether or not the @@ -1103,14 +1103,14 @@ void OPML( yymx = yypParser->yytos->major; if ( yymx == YYERRORSYMBOL || yyerrorhit ) { - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { fprintf(yyTraceFILE, "%sDiscard input token %s\n", yyTracePrompt, yyTokenName[yymajor]); } - #endif +#endif yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; } else { @@ -1126,9 +1126,9 @@ void OPML( if ( yypParser->yytos < yypParser->yystack || yymajor == 0 ) { yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yy_parse_failed(yypParser); - #ifndef YYNOERRORRECOVERY +#ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; - #endif +#endif yymajor = YYNOCODE; } else if ( yymx != YYERRORSYMBOL ) { yy_shift(yypParser, yyact, YYERRORSYMBOL, yyminor); @@ -1137,7 +1137,7 @@ void OPML( yypParser->yyerrcnt = 3; yyerrorhit = 1; - #elif defined(YYNOERRORRECOVERY) +#elif defined(YYNOERRORRECOVERY) /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax ** error routine and continue going as if nothing had happened. @@ -1149,7 +1149,7 @@ void OPML( yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; - #else /* YYERRORSYMBOL is not defined */ +#else /* YYERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** @@ -1169,17 +1169,17 @@ void OPML( if ( yyendofinput ) { yy_parse_failed(yypParser); - #ifndef YYNOERRORRECOVERY +#ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; - #endif +#endif } yymajor = YYNOCODE; - #endif +#endif } } while ( yymajor != YYNOCODE && yypParser->yytos > yypParser->yystack ); - #ifndef NDEBUG +#ifndef NDEBUG if ( yyTraceFILE ) { yyStackEntry *i; @@ -1194,6 +1194,6 @@ void OPML( fprintf(yyTraceFILE, "]\n"); } - #endif +#endif return; } diff --git a/Sources/libMultiMarkdown/opml-reader.c b/Sources/libMultiMarkdown/opml-reader.c index 602892a..ccc75ac 100644 --- a/Sources/libMultiMarkdown/opml-reader.c +++ b/Sources/libMultiMarkdown/opml-reader.c @@ -194,9 +194,9 @@ void parse_opml_token_chain(mmd_engine * e, token * chain) { token * walker = chain->next; // Walk the existing tree token * remainder; // Hold unparsed tail of chain - #ifndef NDEBUG +#ifndef NDEBUG OPMLTrace(stderr, "parser >>"); - #endif +#endif // Remove existing token tree e->root = NULL; @@ -210,9 +210,9 @@ void parse_opml_token_chain(mmd_engine * e, token * chain) { } // Signal finish to parser - #ifndef NDEBUG +#ifndef NDEBUG fprintf(stderr, "\nFinish parse\n"); - #endif +#endif OPML(pParser, 0, NULL, e); if (e->root) { diff --git a/Sources/libMultiMarkdown/token.c b/Sources/libMultiMarkdown/token.c index 9b79ccd..8337c16 100644 --- a/Sources/libMultiMarkdown/token.c +++ b/Sources/libMultiMarkdown/token.c @@ -115,11 +115,11 @@ void token_pool_free(void) { token * token_new(unsigned short type, size_t start, size_t len) { - #ifdef kUseObjectPool +#ifdef kUseObjectPool token * t = pool_allocate_object(token_pool); - #else +#else token * t = malloc(sizeof(token)); - #endif +#endif if (t) { t->type = type; @@ -145,11 +145,11 @@ token * token_new(unsigned short type, size_t start, size_t len) { /// Duplicate an existing token token * token_copy(token * original) { - #ifdef kUseObjectPool +#ifdef kUseObjectPool token * t = pool_allocate_object(token_pool); - #else +#else token * t = malloc(sizeof(token)); - #endif +#endif if (t) { * t = * original; @@ -387,9 +387,9 @@ token * token_prune_graft(token * first, token * last, unsigned short container_ /// Free token void token_free(token * t) { - #ifdef kUseObjectPool +#ifdef kUseObjectPool return; - #else +#else if (t == NULL) { return; @@ -398,15 +398,15 @@ void token_free(token * t) { token_tree_free(t->child); free(t); - #endif +#endif } /// Free token chain void token_tree_free(token * t) { - #ifdef kUseObjectPool +#ifdef kUseObjectPool return; - #else +#else token * n; while (t != NULL) { @@ -416,7 +416,7 @@ void token_tree_free(token * t) { t = n; } - #endif +#endif } diff --git a/Sources/libMultiMarkdown/token_pairs.c b/Sources/libMultiMarkdown/token_pairs.c index 9100e93..5de9839 100644 --- a/Sources/libMultiMarkdown/token_pairs.c +++ b/Sources/libMultiMarkdown/token_pairs.c @@ -213,9 +213,9 @@ close: opener_count[peek->type]--; } - #ifndef NDEBUG +#ifndef NDEBUG fprintf(stderr, "stack now sized %lu\n", s->size); - #endif +#endif // Prune matched section if (e->should_prune[pair_type]) { @@ -230,12 +230,12 @@ close: break; } - #ifndef NDEBUG +#ifndef NDEBUG else { fprintf(stderr, "token type %d failed to match stack element\n", walker->type); } - #endif +#endif i--; } } @@ -246,17 +246,17 @@ open: if (walker->can_open && e->can_open_pair[walker->type] && walker->unmatched) { stack_push(s, walker); opener_count[walker->type]++; - #ifndef NDEBUG +#ifndef NDEBUG fprintf(stderr, "push token type %d to stack (%lu elements)\n", walker->type, s->size); - #endif +#endif } walker = walker->next; } - #ifndef NDEBUG +#ifndef NDEBUG fprintf(stderr, "token stack has %lu elements (of %lu)\n", s->size, s->capacity); - #endif +#endif // Remove unused tokens from stack and return to parent s->size = start_counter; diff --git a/Sources/libMultiMarkdown/writer.c b/Sources/libMultiMarkdown/writer.c index 8763557..0696230 100644 --- a/Sources/libMultiMarkdown/writer.c +++ b/Sources/libMultiMarkdown/writer.c @@ -636,10 +636,10 @@ attr * parse_attributes(char * source) { a->next = attr_new(key, value); a = a->next; } else { - #ifndef __clang_analyzer__ +#ifndef __clang_analyzer__ a = attr_new(key, value); attributes = a; - #endif +#endif } free(value); // We stored a modified copy @@ -1150,11 +1150,11 @@ footnote * footnote_new(const char * source, token * label, token * content, boo void footnote_free(footnote * f) { if (f) { if (f->free_para) { - #ifdef kUseObjectPool +#ifdef kUseObjectPool // Nothing to do here - #else +#else free(f->content); - #endif +#endif } free(f->clean_text); diff --git a/Sources/multimarkdown/main.c b/Sources/multimarkdown/main.c index 5cdb764..d9c6d76 100644 --- a/Sources/multimarkdown/main.c +++ b/Sources/multimarkdown/main.c @@ -332,9 +332,9 @@ int main(int argc, char** argv) { char * output_filename; // Increment counter and prepare token pool - #ifdef kUseObjectPool +#ifdef kUseObjectPool token_pool_init(); - #endif +#endif // Seed random numbers custom_seed_rand(); @@ -422,9 +422,9 @@ int main(int argc, char** argv) { } // Increment counter and prepare token pool - #ifdef kUseObjectPool +#ifdef kUseObjectPool token_pool_init(); - #endif +#endif if (a_meta->count > 0) { // List metadata keys @@ -508,20 +508,20 @@ int main(int argc, char** argv) { // Perform transclusion(s) // Convert to absolute path for first file to enable proper path resolution - #ifdef PATH_MAX +#ifdef PATH_MAX // If PATH_MAX defined, use it char absolute[PATH_MAX + 1]; realpath(a_file->filename[0], absolute); folder = dirname((char *) a_file->filename[0]); mmd_transclude_source(buffer, folder, absolute, format, NULL, NULL); - #else +#else // If undefined, then we *should* be able to use a NULL pointer to allocate char * absolute = realpath(a_file->filename[0], NULL); folder = dirname((char *) a_file->filename[0]); mmd_transclude_source(buffer, folder, absolute, format, NULL, NULL); free(absolute); - #endif +#endif // Don't free folder -- owned by dirname } @@ -597,9 +597,9 @@ exit: // Decrement counter and clean up token pool token_pool_drain(); - #ifdef kUseObjectPool +#ifdef kUseObjectPool token_pool_free(); - #endif +#endif exit2: