clang-format styling matching upstream

Signed-off-by: Anestis Bechtsoudis <anestis@census-labs.com>
This commit is contained in:
Anestis Bechtsoudis 2019-11-05 11:50:49 +02:00
parent 7ab241c783
commit a8514caa7c
No known key found for this signature in database
GPG Key ID: D7248CD88CBAB8EE
5 changed files with 18 additions and 8 deletions

9
.clang-format Normal file
View File

@ -0,0 +1,9 @@
BasedOnStyle: Google
AllowShortFunctionsOnASingleLine: Inline
ColumnLimit: 100
CommentPragmas: NOLINT:.*
DerivePointerAlignment: false
IndentWidth: 2
PointerAlignment: Left
TabWidth: 2
UseTab: Never

View File

@ -106,5 +106,5 @@ endif
@$(RM) .depend
@$(foreach SRC, $(SRCS), $(DEP_CXX) $(LIB_INCS) $(SRC) $(CFLAGS) -MT $(SRC:%.c=%.o) -MM >> .depend;)
indent:
indent -linux -l100 -lc100 -nut -i4 *.cpp *.h; rm -f *~
format:
find . -regex '.*\.\(cpp\|hpp\|cc\|cxx\)' -exec clang-format -style=file -i {} \;

View File

@ -595,8 +595,8 @@ struct output_file* output_file_open_callback(int (*write)(void*, const void*, s
int ret;
struct output_file_callback* outc;
outc =
reinterpret_cast<struct output_file_callback*>(calloc(1, sizeof(struct output_file_callback)));
outc = reinterpret_cast<struct output_file_callback*>(
calloc(1, sizeof(struct output_file_callback)));
if (!outc) {
error_errno("malloc struct outc");
return nullptr;
@ -663,8 +663,8 @@ int write_fd_chunk(struct output_file* out, unsigned int len, int fd, int64_t of
#ifndef _WIN32
if (buffer_size > SIZE_MAX) return -E2BIG;
char* data =
reinterpret_cast<char*>(mmap64(nullptr, buffer_size, PROT_READ, MAP_SHARED, fd, aligned_offset));
char* data = reinterpret_cast<char*>(
mmap64(nullptr, buffer_size, PROT_READ, MAP_SHARED, fd, aligned_offset));
if (data == MAP_FAILED) {
return -errno;
}

View File

@ -72,7 +72,7 @@ int main(int argc, char* argv[]) {
exit(-1);
}
out_s = (struct sparse_file**) calloc(sizeof(struct sparse_file*), files);
out_s = (struct sparse_file**)calloc(sizeof(struct sparse_file*), files);
if (!out_s) {
fprintf(stderr, "Failed to allocate sparse file array\n");
exit(-1);

View File

@ -175,7 +175,8 @@ struct chunk_data {
void* priv;
unsigned int block;
unsigned int nr_blocks;
int (*write)(void* priv, const void* data, size_t len, unsigned int block, unsigned int nr_blocks);
int (*write)(void* priv, const void* data, size_t len, unsigned int block,
unsigned int nr_blocks);
};
static int foreach_chunk_write(void* priv, const void* data, size_t len) {