From: Fletcher T. Penney Date: Sat, 22 Jul 2017 00:44:13 +0000 (-0400) Subject: UPDATED: Tweaked astyle settings X-Git-Tag: 6.2.0^2~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=525e408c7c7d1ade9099f2752bd9606ff6043d43;p=multimarkdown UPDATED: Tweaked astyle settings --- diff --git a/Sources/libMultiMarkdown/char_lookup.c b/Sources/libMultiMarkdown/char_lookup.c index 26799a8..e61a36c 100644 --- a/Sources/libMultiMarkdown/char_lookup.c +++ b/Sources/libMultiMarkdown/char_lookup.c @@ -138,7 +138,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) { punctuation(i); @@ -192,7 +192,7 @@ int main( int argc, char** argv ) { break; } } -#endif + #endif // Print output as 16 x 16 table diff --git a/Sources/libMultiMarkdown/epub.c b/Sources/libMultiMarkdown/epub.c index e07bb99..eb82d56 100644 --- a/Sources/libMultiMarkdown/epub.c +++ b/Sources/libMultiMarkdown/epub.c @@ -59,7 +59,7 @@ #include #ifdef USE_CURL -#include + #include #endif #include "epub.h" diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index 328e57f..87e3ff5 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -957,9 +957,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; @@ -974,9 +974,9 @@ void mmd_parse_token_chain(mmd_engine * e, token * chain) { if (remainder) remainder->prev = NULL; -#ifndef NDEBUG + #ifndef NDEBUG fprintf(stderr, "\nNew line\n"); -#endif + #endif Parse(pParser, walker->type, walker, e); @@ -984,9 +984,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 @@ -1775,10 +1775,10 @@ void strip_line_tokens_from_block(mmd_engine * e, token * block) { if ((block == NULL) || (block->child == NULL)) 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, NULL); -#endif + #endif token * l = block->child; @@ -1955,9 +1955,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 doc; diff --git a/Sources/libMultiMarkdown/opendocument.c b/Sources/libMultiMarkdown/opendocument.c index d3e318b..6d42536 100644 --- a/Sources/libMultiMarkdown/opendocument.c +++ b/Sources/libMultiMarkdown/opendocument.c @@ -102,7 +102,7 @@ */ #ifdef USE_CURL -#include + #include #endif #include "miniz.h" diff --git a/Sources/libMultiMarkdown/rng.c b/Sources/libMultiMarkdown/rng.c index 1a239da..8646399 100644 --- a/Sources/libMultiMarkdown/rng.c +++ b/Sources/libMultiMarkdown/rng.c @@ -26,11 +26,11 @@ long ran_x[KK]; /* the generator state */ #ifdef __STDC__ -void ran_array(long aa[],int n) + void ran_array(long aa[],int n) #else -void ran_array(aa,n) /* put n new random numbers in aa */ -long *aa; /* destination */ -int n; /* array length (must be at least KK) */ + void ran_array(aa,n) /* put n new random numbers in aa */ + long *aa; /* destination */ + int n; /* array length (must be at least KK) */ #endif { register int i,j; @@ -52,10 +52,10 @@ long *ran_arr_ptr=&ran_arr_dummy; /* the next random number, or -1 */ #define is_odd(x) ((x)&1) /* units bit of x */ #ifdef __STDC__ -void ran_start(long seed) + void ran_start(long seed) #else -void ran_start(seed) /* do this before using ran_array */ -long seed; /* selector for different streams */ + void ran_start(seed) /* do this before using ran_array */ + long seed; /* selector for different streams */ #endif { register int t,j; diff --git a/Sources/libMultiMarkdown/textbundle.c b/Sources/libMultiMarkdown/textbundle.c index bdd1d78..07b93f3 100644 --- a/Sources/libMultiMarkdown/textbundle.c +++ b/Sources/libMultiMarkdown/textbundle.c @@ -106,7 +106,7 @@ #include #ifdef USE_CURL -#include + #include #endif #include "textbundle.h" diff --git a/Sources/libMultiMarkdown/token.c b/Sources/libMultiMarkdown/token.c index de6aa61..6af41a1 100644 --- a/Sources/libMultiMarkdown/token.c +++ b/Sources/libMultiMarkdown/token.c @@ -114,11 +114,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; @@ -144,11 +144,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; @@ -360,24 +360,24 @@ 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; 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) { @@ -386,7 +386,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 e19622a..c55e086 100644 --- a/Sources/libMultiMarkdown/token_pairs.c +++ b/Sources/libMultiMarkdown/token_pairs.c @@ -204,9 +204,9 @@ close: peek = stack_pop(s); 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]) { @@ -220,11 +220,11 @@ close: break; } -#ifndef NDEBUG + #ifndef NDEBUG else { fprintf(stderr, "token type %d failed to match stack element\n", walker->type); } -#endif + #endif i--; } } @@ -234,17 +234,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/transclude.c b/Sources/libMultiMarkdown/transclude.c index d6e24df..41a0226 100644 --- a/Sources/libMultiMarkdown/transclude.c +++ b/Sources/libMultiMarkdown/transclude.c @@ -60,7 +60,7 @@ #include "transclude.h" #if defined(__WIN32) -#include + #include #endif #define kBUFFERSIZE 4096 // How many bytes to read at a time @@ -106,11 +106,11 @@ static char * my_strdup(const char * source) { /// 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 } @@ -118,25 +118,25 @@ 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 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 (!is_separator(path->str[path->currentStringLength - 1])) { @@ -182,11 +182,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"); @@ -209,11 +209,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; @@ -238,13 +238,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 @@ -258,15 +258,15 @@ 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"r")) == NULL) { -#else + #else if ((file = fopen(fname, "r")) == NULL ) { -#endif + #endif return NULL; } diff --git a/Sources/libMultiMarkdown/writer.c b/Sources/libMultiMarkdown/writer.c index 80b6263..73e26f3 100644 --- a/Sources/libMultiMarkdown/writer.c +++ b/Sources/libMultiMarkdown/writer.c @@ -1051,11 +1051,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); free(f->label_text); diff --git a/Sources/multimarkdown/main.c b/Sources/multimarkdown/main.c index ab11e0e..97b257e 100644 --- a/Sources/multimarkdown/main.c +++ b/Sources/multimarkdown/main.c @@ -326,9 +326,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(); @@ -401,9 +401,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 char_result = mmd_string_metadata_keys(buffer->str); @@ -488,20 +488,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 } @@ -578,9 +578,9 @@ exit: // Decrement counter and clean up token pool token_pool_drain(); -#ifdef kUseObjectPool + #ifdef kUseObjectPool token_pool_free(); -#endif + #endif exit2: