diff --git a/src/bbs.h b/src/bbs.h index 0501974..55a29a7 100644 --- a/src/bbs.h +++ b/src/bbs.h @@ -274,7 +274,7 @@ struct ptr_vector { void **ptrs; }; -static const struct ptr_vector EMPTY_PTR_VECTOR = { 0, 0, NULL }; +static const struct ptr_vector EMPTY_PTR_VECTOR = {0, 0, NULL}; extern void init_ptr_vector(struct ptr_vector *vec); extern void ptr_vector_clear(struct ptr_vector *vec); diff --git a/src/mail_menu.c b/src/mail_menu.c index 370990e..76a2677 100644 --- a/src/mail_menu.c +++ b/src/mail_menu.c @@ -568,7 +568,7 @@ char *editor(struct user_record *user, char *quote, int quotelen, char *from, in if (quote != NULL) { for (i = 0; i < quotelen; i++) { if (quote[i] == '\r' || lineat == 67) { - char prefix[] = { from[0], '>', '\0' }; + char prefix[] = {from[0], '>', '\0'}; ptr_vector_append("econtent, str3dup(prefix, " ", linebuffer)); lineat = 0; linebuffer[0] = '\0'; @@ -2645,7 +2645,7 @@ void choose_conference() { init_ptr_vector(&vec); for (i = 0; i < conf.mail_conference_count; i++) { if (conf.mail_conferences[i]->sec_level <= gUser->sec_level) { - struct conf_tmp_t *c= (struct conf_tmp_t *)malloz(sizeof(struct conf_tmp_t)); + struct conf_tmp_t *c = (struct conf_tmp_t *)malloz(sizeof(struct conf_tmp_t)); c->conference = conf.mail_conferences[i]; c->index = i; ptr_vector_append(&vec, c); diff --git a/src/stralloc/stralloc.c b/src/stralloc/stralloc.c index 4f2bcf6..ebc410b 100644 --- a/src/stralloc/stralloc.c +++ b/src/stralloc/stralloc.c @@ -49,7 +49,7 @@ int stralloc_copyb(stralloc *sa, const char *s, size_t n) { int stralloc_catb(stralloc *sa, const char *s, size_t n) { assert(sa != NULL); assert(s != NULL); - if (sa->s == NULL) return stralloc_copyb(sa,s,n); + if (sa->s == NULL) return stralloc_copyb(sa, s, n); if (!stralloc_readyplus(sa, n + 1)) return 0; memmove(sa->s + sa->len, s, n); sa->len += n; diff --git a/src/stralloc/stralloc.h b/src/stralloc/stralloc.h index 9089284..918f760 100644 --- a/src/stralloc/stralloc.h +++ b/src/stralloc/stralloc.h @@ -12,7 +12,7 @@ struct stralloc { size_t a; }; -static const stralloc EMPTY_STRALLOC = { NULL, 0, 0 }; +static const stralloc EMPTY_STRALLOC = {NULL, 0, 0}; extern int stralloc_ready(stralloc *sa, size_t n); extern int stralloc_starts(stralloc *sa, const char *s); @@ -45,7 +45,7 @@ static inline int stralloc_copys(stralloc *sa, const char *s) { } static inline int stralloc_cats(stralloc *sa, const char *s) { - return stralloc_catb(sa, s, strlen(s)); + return stralloc_catb(sa, s, strlen(s)); } static inline int stralloc_0(stralloc *sa) { diff --git a/src/stralloc/test_stralloc.c b/src/stralloc/test_stralloc.c index 87be9d9..7b6bb78 100644 --- a/src/stralloc/test_stralloc.c +++ b/src/stralloc/test_stralloc.c @@ -6,32 +6,32 @@ #include "stralloc.h" -void test_stralloc_starts(CuTest* tc) { +void test_stralloc_starts(CuTest *tc) { stralloc sa = EMPTY_STRALLOC; stralloc_copys(&sa, "This is a test"); CuAssertTrue(tc, stralloc_starts(&sa, "This")); } -void test_stralloc_starts_equal(CuTest* tc) { +void test_stralloc_starts_equal(CuTest *tc) { stralloc sa = EMPTY_STRALLOC; stralloc_copys(&sa, "This is a test"); CuAssertTrue(tc, stralloc_starts(&sa, "This is a test")); } -void test_stralloc_starts_notequal(CuTest* tc) { +void test_stralloc_starts_notequal(CuTest *tc) { stralloc sa = EMPTY_STRALLOC; stralloc_copys(&sa, "This is a test"); CuAssertTrue(tc, !stralloc_starts(&sa, "this")); } -void test_stralloc_starts_toolong(CuTest* tc) { +void test_stralloc_starts_toolong(CuTest *tc) { stralloc sa = EMPTY_STRALLOC; stralloc_copys(&sa, "This is a test"); CuAssertTrue(tc, !stralloc_starts(&sa, "This is a test!")); } -CuSuite* stralloc_suite(void) { - CuSuite* suite = CuSuiteNew(); +CuSuite *stralloc_suite(void) { + CuSuite *suite = CuSuiteNew(); SUITE_ADD_TEST(suite, test_stralloc_starts); SUITE_ADD_TEST(suite, test_stralloc_starts_equal); @@ -43,7 +43,7 @@ CuSuite* stralloc_suite(void) { void RunAllTests(void) { CuString *output = CuStringNew(); - CuSuite* suite = CuSuiteNew(); + CuSuite *suite = CuSuiteNew(); CuSuiteAddSuite(suite, stralloc_suite()); diff --git a/src/strlcpy/strlcat.c b/src/strlcpy/strlcat.c index f27dfe0..cd3c8a2 100644 --- a/src/strlcpy/strlcat.c +++ b/src/strlcpy/strlcat.c @@ -27,8 +27,7 @@ * If retval >= dsize, truncation occurred. */ size_t -strlcat(char *dst, const char *src, size_t dsize) -{ +strlcat(char *dst, const char *src, size_t dsize) { const char *odst = dst; const char *osrc = src; size_t n = dsize; @@ -41,7 +40,7 @@ strlcat(char *dst, const char *src, size_t dsize) n = dsize - dlen; if (n-- == 0) - return(dlen + strlen(src)); + return (dlen + strlen(src)); while (*src != '\0') { if (n != 0) { *dst++ = *src; @@ -51,5 +50,5 @@ strlcat(char *dst, const char *src, size_t dsize) } *dst = '\0'; - return(dlen + (src - osrc)); /* count does not include NUL */ + return (dlen + (src - osrc)); /* count does not include NUL */ } diff --git a/src/strlcpy/strlcpy.c b/src/strlcpy/strlcpy.c index 241586e..f009122 100644 --- a/src/strlcpy/strlcpy.c +++ b/src/strlcpy/strlcpy.c @@ -25,8 +25,7 @@ * Returns strlen(src); if retval >= dsize, truncation occurred. */ size_t -strlcpy(char *dst, const char *src, size_t dsize) -{ +strlcpy(char *dst, const char *src, size_t dsize) { const char *osrc = src; size_t nleft = dsize; @@ -41,10 +40,10 @@ strlcpy(char *dst, const char *src, size_t dsize) /* Not enough room in dst, add NUL and traverse rest of src. */ if (nleft == 0) { if (dsize != 0) - *dst = '\0'; /* NUL-terminate dst */ + *dst = '\0'; /* NUL-terminate dst */ while (*src++) ; } - return(src - osrc - 1); /* count does not include NUL */ + return (src - osrc - 1); /* count does not include NUL */ } diff --git a/src/util.c b/src/util.c index 5b53b7b..03b6f46 100644 --- a/src/util.c +++ b/src/util.c @@ -130,7 +130,7 @@ int ptr_vector_ins(struct ptr_vector *vec, void *p, size_t i) { // for and simply appending in this case. if (i == vec->len) return ptr_vector_append(vec, p); - ptr_vector_append(vec, NULL); // Make space in the vector. + ptr_vector_append(vec, NULL); // Make space in the vector. memmove(vec->ptrs + i + 1, vec->ptrs + i, (vec->len - (i + 1)) * sizeof(void *)); vec->ptrs[i] = p; diff --git a/src/www_msgs.c b/src/www_msgs.c index 4acfb4b..3f229a2 100644 --- a/src/www_msgs.c +++ b/src/www_msgs.c @@ -1073,7 +1073,7 @@ char *www_new_msg(struct user_record *user, int conference, int area) { stralloc_cats(&page, "