]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Tweak code style
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 22 Jun 2019 20:44:01 +0000 (22:44 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 26 Jun 2019 19:14:53 +0000 (21:14 +0200)
Makefile.in
src/common_header.h
src/compr_zlib.c
src/compr_zstd.c
src/compression.h
src/confitems.c
src/decompr_zlib.c
src/decompr_zstd.c
src/result.c
unittest/test_compr_zstd.c
unittest/test_conf.c

index 9bd954f8f5d923da871cf60e396bbd4aa8c3560c..93cb71fae814bb0e56f1adb3cf018100648824ec 100644 (file)
@@ -37,8 +37,8 @@ non_3pp_sources = \
     src/compopt.c \
     src/compr_none.c \
     src/compr_zlib.c \
-    src/compression.c \
     src/compr_zstd.c \
+    src/compression.c \
     src/conf.c \
     src/confitems.c \
     src/counters.c \
index 09f1aa6e8388da5dd223cdd110cf0232046e7e94..69fd027caa1dd17beb77e1b2ee5071cf8f1d453d 100644 (file)
@@ -1,7 +1,6 @@
 #define COMMON_HEADER_SIZE 15
 
-struct common_header
-{
+struct common_header {
        char magic[4];
        uint8_t version;
        uint8_t compression_type;
index a174ecf2a024d18d18c7cd0ca618b6d8ac59fc13..899c4c7e69f36aead2f51b9d30bd2cf789526738 100644 (file)
@@ -19,8 +19,7 @@
 
 #include <zlib.h>
 
-struct state
-{
+struct state {
        FILE *output;
        z_stream stream;
        bool failed;
index 49840101f22bccc209f7592b6fcfc9691db4f8af..998dfbb48b1c9d1cfabe483fcf8591bdb2ba604d 100644 (file)
@@ -22,8 +22,8 @@
 #endif
 
 #ifdef HAVE_LIBZSTD
-struct state
-{
+
+struct state {
        FILE *output;
        ZSTD_CStream *stream;
        ZSTD_inBuffer in;
@@ -78,7 +78,7 @@ compr_zstd_write(struct compr_state *handle, const void *data, size_t size)
                }
        }
        ret = flush;
-       while (ret) {
+       while (ret > 0) {
                unsigned char buffer[READ_BUFFER_SIZE];
                state->out.dst = buffer;
                state->out.size = sizeof(buffer);
@@ -115,4 +115,5 @@ struct compressor compressor_zstd_impl = {
        compr_zstd_write,
        compr_zstd_free
 };
-#endif //HAVE_LIBZSTD
+
+#endif // HAVE_LIBZSTD
index b087ea81c728ea2ee9caabc74cee7da7ccf7c2eb..19baafdeb23cccb68608811c9a981870c1c7e2c3 100644 (file)
@@ -34,7 +34,7 @@ extern struct decompressor decompressor_zlib_impl;
 #ifdef HAVE_LIBZSTD
 extern struct compressor compressor_zstd_impl;
 extern struct decompressor decompressor_zstd_impl;
-#endif //HAVE_LIBZSTD
+#endif // HAVE_LIBZSTD
 
 int8_t compression_level_from_config(void);
 enum compression_type compression_type_from_config(void);
index 1c24464105fb3b610e3feb84e054ae46da962d8e..d9d14bdd5b724d7e68ed629b69d78e402e1c0cd8 100644 (file)
@@ -20,7 +20,7 @@
 static char *
 format_string(const void *value)
 {
-       const char * const *str = (const char * const*)value;
+       const char *const *str = (const char *const *)value;
        return x_strdup(*str);
 }
 
@@ -268,7 +268,7 @@ confitem_format_unsigned(const void *value)
 bool
 confitem_verify_absolute_path(const void *value, char **errmsg)
 {
-       const char * const *path = (const char * const *)value;
+       const char *const *path = (const char *const *)value;
        assert(*path);
        if (str_eq(*path, "")) {
                // The empty string means "disable" in this case.
index e5ddada2884ae70043cb421a5b1e32b908a96602..3f3ec2c0149f07018d4fa797f982c9f637fa76a0 100644 (file)
@@ -25,8 +25,7 @@ enum stream_state {
        STREAM_STATE_END
 };
 
-struct state
-{
+struct state {
        FILE *input;
        char input_buffer[READ_BUFFER_SIZE];
        size_t input_size;
index 8fc3ace4f11aadc036970c89b3493c9a66bd6a56..96ec79a57b61f00af937f3d5ab58ac68b7b73881 100644 (file)
 #endif
 
 #ifdef HAVE_LIBZSTD
+
 enum stream_state {
        STREAM_STATE_READING,
        STREAM_STATE_FAILED,
        STREAM_STATE_END
 };
 
-struct state
-{
+struct state {
        FILE *input;
        char input_buffer[READ_BUFFER_SIZE];
        size_t input_size;
@@ -120,4 +120,5 @@ struct decompressor decompressor_zstd_impl = {
        decompr_zstd_read,
        decompr_zstd_free
 };
-#endif //HAVE_LIBZSTD
+
+#endif // HAVE_LIBZSTD
index 43e46d10d06e0cd4c242f9d1da0bc147234a9cf1..62cf4dbf2f41367683250205e77bb271ce28f64a 100644 (file)
@@ -101,7 +101,8 @@ result_files_init(void)
 }
 
 void
-result_files_add(struct result_files *list, const char *path, const char *suffix)
+result_files_add(struct result_files *list, const char *path,
+                 const char *suffix)
 {
        uint32_t n = list->n_files;
        list->files = x_realloc(list->files, (n + 1) * sizeof(*list->files));
@@ -232,8 +233,8 @@ read_result(
                        break;
 
                case REF_MARKER:
-                       // TODO: Implement.
-                       // Fall through.
+               // TODO: Implement.
+               // Fall through.
 
                default:
                        *errmsg = format("Unknown entry type: %u", marker);
index 16e4ff927b79c7b6df6d4f50c43a8173ac3123fd..bd3c5e8034e087e1a8021f255a8c458f54509b8d 100644 (file)
@@ -21,6 +21,7 @@
 TEST_SUITE(compr_zstd)
 
 #ifdef HAVE_LIBZSTD
+
 TEST(zstd_small_roundtrip)
 {
        FILE *f = fopen("data.zstd", "w");
@@ -116,11 +117,14 @@ TEST(zstd_large_uncompressible_roundtrip)
        CHECK(decompr_zstd->free(d_state));
        fclose(f);
 }
-#else
+
+#else // HAVE_LIBZSTD
+
 TEST(zstd_skip)
 {
        // disabled
 }
+
 #endif // HAVE_LIBZSTD
 
 TEST_SUITE_END
index 27850734245f5da05403ce7aee94d8746df2001f..930125ba4a9c3fbb1b79d0381ca17f6a3f0ae718 100644 (file)
@@ -370,7 +370,8 @@ TEST(conf_set_new_value)
        char *data;
 
        create_file("ccache.conf", "path = vanilla\n");
-       CHECKM(conf_set_value_in_file("ccache.conf", "compiler", "chocolate", &errmsg),
+       CHECKM(conf_set_value_in_file("ccache.conf", "compiler", "chocolate",
+                                     &errmsg),
               errmsg);
        data = read_text_file("ccache.conf", 0);
        CHECK(data);