Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-05-21 01:26:59 +0300
committerJunio C Hamano <gitster@pobox.com>2022-05-21 01:26:59 +0300
commit538dc459a0331c48b893c9f6ca0be5917860bb99 (patch)
treed8b7cf10c62573f767116c14f7ffd0d9e1d8ec32 /reftable/writer.c
parentacdeb10f91da939135fbacb847792ae237450d7d (diff)
parent72a4ea71e5f29e4078363e87e4471128ff713a62 (diff)
Merge branch 'ep/maint-equals-null-cocci'
Introduce and apply coccinelle rule to discourage an explicit comparison between a pointer and NULL, and applies the clean-up to the maintenance track. * ep/maint-equals-null-cocci: tree-wide: apply equals-null.cocci tree-wide: apply equals-null.cocci contrib/coccinnelle: add equals-null.cocci
Diffstat (limited to 'reftable/writer.c')
-rw-r--r--reftable/writer.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/reftable/writer.c b/reftable/writer.c
index 427f1317c6..2e322a5683 100644
--- a/reftable/writer.c
+++ b/reftable/writer.c
@@ -183,7 +183,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;
@@ -222,7 +222,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));
}
@@ -263,7 +263,7 @@ int reftable_writer_add_ref(struct reftable_writer *w,
};
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)
@@ -336,7 +336,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;
@@ -545,7 +545,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);
@@ -694,7 +694,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;