]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tree-wide: apply equals-null.cocci
authorJunio C Hamano <gitster@pobox.com>
Mon, 2 May 2022 17:09:21 +0000 (10:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 May 2022 17:09:21 +0000 (10:09 -0700)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/stack_test.c
reftable/tree.c
reftable/writer.c

index f4c743db80c391c1b6c91d3d5f178c76b4393964..e2c701430305df81199ea668b7ed6b3f2184cb15 100644 (file)
@@ -35,7 +35,7 @@ static int count_dir_entries(const char *dirname)
        DIR *dir = opendir(dirname);
        int len = 0;
        struct dirent *d;
-       if (dir == NULL)
+       if (!dir)
                return 0;
 
        while ((d = readdir(dir))) {
index 82db7995dd68ec9f8f8b7756582d9be749f13a9b..b8899e060abdd6629d73510a8b126b0c00c90b8d 100644 (file)
@@ -16,7 +16,7 @@ struct tree_node *tree_search(void *key, struct tree_node **rootp,
                              int insert)
 {
        int res;
-       if (*rootp == NULL) {
+       if (!*rootp) {
                if (!insert) {
                        return NULL;
                } else {
@@ -50,7 +50,7 @@ void infix_walk(struct tree_node *t, void (*action)(void *arg, void *key),
 
 void tree_free(struct tree_node *t)
 {
-       if (t == NULL) {
+       if (!t) {
                return;
        }
        if (t->left) {
index 35c8649c9b73cdd06d279a6364440d017c66a9fc..ea483955e8fe6c39d3cc6f54ff97e320026cebe9 100644 (file)
@@ -181,7 +181,7 @@ static void writer_index_hash(struct reftable_writer *w, struct strbuf *hash)
        struct tree_node *node = tree_search(&want, &w->obj_index_tree,
                                             &obj_index_tree_node_compare, 0);
        struct obj_index_tree_node *key = NULL;
-       if (node == NULL) {
+       if (!node) {
                struct obj_index_tree_node empty = OBJ_INDEX_TREE_NODE_INIT;
                key = reftable_malloc(sizeof(struct obj_index_tree_node));
                *key = empty;
@@ -220,7 +220,7 @@ static int writer_add_record(struct reftable_writer *w,
 
        strbuf_reset(&w->last_key);
        strbuf_addbuf(&w->last_key, &key);
-       if (w->block_writer == NULL) {
+       if (!w->block_writer) {
                writer_reinit_block_writer(w, reftable_record_type(rec));
        }
 
@@ -258,7 +258,7 @@ int reftable_writer_add_ref(struct reftable_writer *w,
        struct reftable_ref_record copy = *ref;
        int err = 0;
 
-       if (ref->refname == NULL)
+       if (!ref->refname)
                return REFTABLE_API_ERROR;
        if (ref->update_index < w->min_update_index ||
            ref->update_index > w->max_update_index)
@@ -329,7 +329,7 @@ int reftable_writer_add_log(struct reftable_writer *w,
        if (log->value_type == REFTABLE_LOG_DELETION)
                return reftable_writer_add_log_verbatim(w, log);
 
-       if (log->refname == NULL)
+       if (!log->refname)
                return REFTABLE_API_ERROR;
 
        input_log_message = log->value.update.message;
@@ -531,7 +531,7 @@ static int writer_finish_public_section(struct reftable_writer *w)
        uint8_t typ = 0;
        int err = 0;
 
-       if (w->block_writer == NULL)
+       if (!w->block_writer)
                return 0;
 
        typ = block_writer_type(w->block_writer);
@@ -680,7 +680,7 @@ static int writer_flush_nonempty_block(struct reftable_writer *w)
 
 static int writer_flush_block(struct reftable_writer *w)
 {
-       if (w->block_writer == NULL)
+       if (!w->block_writer)
                return 0;
        if (w->block_writer->entries == 0)
                return 0;