Trivial clang-format changes

Changes from a clang-format run.

Signed-off-by: Dan Cross <patchdev@fat-dragon.org>
This commit is contained in:
Dan Cross 2018-10-11 14:02:55 +00:00 committed by Andrew Pamment
parent e548c94750
commit cf766e3e67
9 changed files with 21 additions and 23 deletions

View File

@ -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);

View File

@ -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(&quotecontent, 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);

View File

@ -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;

View File

@ -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) {

View File

@ -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());

View File

@ -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 */
}

View File

@ -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 */
}

View File

@ -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;

View File

@ -1073,7 +1073,7 @@ char *www_new_msg(struct user_record *user, int conference, int area) {
stralloc_cats(&page, "<form action=\"");
stralloc_cats(&page, conf.www_url);
stralloc_cats(&page, "msgs/\" method=\"POST\" onsubmit=\"return validate()\" "
"enctype=\"application/x-www-form-urlencoded;charset=UTF-8\">\n");
"enctype=\"application/x-www-form-urlencoded;charset=UTF-8\">\n");
stralloc_cats(&page, "<input type=\"hidden\" name=\"conference\" value=\"");
stralloc_cat_long(&page, conference);
stralloc_cats(&page, "\" />\n");