···32743274{
32753275 struct string_list_item *item;
3276327632773277- if (name == NULL)
32773277+ if (!name)
32783278 return NULL;
3279327932803280 item = string_list_lookup(&state->fn_table, name);
32813281- if (item != NULL)
32813281+ if (item)
32823282 return (struct patch *)item->util;
3283328332843284 return NULL;
···33183318 * This should cover the cases for normal diffs,
33193319 * file creations and copies
33203320 */
33213321- if (patch->new_name != NULL) {
33213321+ if (patch->new_name) {
33223322 item = string_list_insert(&state->fn_table, patch->new_name);
33233323 item->util = patch;
33243324 }
+1-1
archive.c
···465465 }
466466467467 tree = parse_tree_indirect(&oid);
468468- if (tree == NULL)
468468+ if (!tree)
469469 die(_("not a tree object: %s"), oid_to_hex(&oid));
470470471471 if (prefix) {
···466466 break;
467467 }
468468469469- if ((commit = lookup_commit_reference(r, &oid)) == NULL)
469469+ if (!(commit = lookup_commit_reference(r, &oid)))
470470 die(_("not a valid branch point: '%s'"), start_name);
471471 if (out_real_ref) {
472472 *out_real_ref = real_ref;
+1-1
builtin/bisect--helper.c
···433433 if (get_terms(terms))
434434 return error(_("no terms defined"));
435435436436- if (option == NULL) {
436436+ if (!option) {
437437 printf(_("Your current terms are %s for the old state\n"
438438 "and %s for the new state.\n"),
439439 terms->term_good, terms->term_bad);
+1-1
builtin/checkout.c
···834834 if (ret)
835835 return ret;
836836 o.ancestor = old_branch_info->name;
837837- if (old_branch_info->name == NULL) {
837837+ if (!old_branch_info->name) {
838838 strbuf_add_unique_abbrev(&old_commit_shortname,
839839 &old_branch_info->commit->object.oid,
840840 DEFAULT_ABBREV);
+2-2
builtin/clone.c
···11061106 * apply the remote name provided by --origin only after this second
11071107 * call to git_config, to ensure it overrides all config-based values.
11081108 */
11091109- if (option_origin != NULL)
11091109+ if (option_origin)
11101110 remote_name = xstrdup(option_origin);
1111111111121112- if (remote_name == NULL)
11121112+ if (!remote_name)
11131113 remote_name = xstrdup("origin");
1114111411151115 if (!valid_remote_name(remote_name))
+1-1
builtin/commit.c
···861861 }
862862863863 s->fp = fopen_for_writing(git_path_commit_editmsg());
864864- if (s->fp == NULL)
864864+ if (!s->fp)
865865 die_errno(_("could not open '%s'"), git_path_commit_editmsg());
866866867867 /* Ignore status.displayCommentPrefix: we do need comments in COMMIT_EDITMSG. */
···446446 fscanf(fp, scan_fmt, &pid, locking_host) == 2 &&
447447 /* be gentle to concurrent "gc" on remote hosts */
448448 (strcmp(locking_host, my_host) || !kill(pid, 0) || errno == EPERM);
449449- if (fp != NULL)
449449+ if (fp)
450450 fclose(fp);
451451 if (should_exit) {
452452 if (fd >= 0)
···22382238 goto error;
22392239 }
22402240 file = fopen_or_warn(filename, "w");
22412241- if (file == NULL)
22412241+ if (!file)
22422242 goto error;
2243224322442244 unit = "# This file was created and is maintained by Git.\n"
···2267226722682268 filename = xdg_config_home_systemd("git-maintenance@.service");
22692269 file = fopen_or_warn(filename, "w");
22702270- if (file == NULL)
22702270+ if (!file)
22712271 goto error;
2272227222732273 unit = "# This file was created and is maintained by Git.\n"
+3-3
builtin/index-pack.c
···19421942 free(objects);
19431943 strbuf_release(&index_name_buf);
19441944 strbuf_release(&rev_index_name_buf);
19451945- if (pack_name == NULL)
19451945+ if (!pack_name)
19461946 free((void *) curr_pack);
19471947- if (index_name == NULL)
19471947+ if (!index_name)
19481948 free((void *) curr_index);
19491949- if (rev_index_name == NULL)
19491949+ if (!rev_index_name)
19501950 free((void *) curr_rev_index);
1951195119521952 /*
+1-1
builtin/log.c
···10121012 if (!quiet)
10131013 printf("%s\n", filename.buf + outdir_offset);
1014101410151015- if ((rev->diffopt.file = fopen(filename.buf, "w")) == NULL) {
10151015+ if (!(rev->diffopt.file = fopen(filename.buf, "w"))) {
10161016 error_errno(_("cannot open patch file %s"), filename.buf);
10171017 strbuf_release(&filename);
10181018 return -1;
+1-1
builtin/ls-remote.c
···114114 }
115115116116 transport = transport_get(remote, NULL);
117117- if (uploadpack != NULL)
117117+ if (uploadpack)
118118 transport_set_option(transport, TRANS_OPT_UPLOADPACK, uploadpack);
119119 if (server_options.nr)
120120 transport->server_options = &server_options;
+1-1
builtin/mailsplit.c
···120120 for (sub = subs; *sub; ++sub) {
121121 free(name);
122122 name = xstrfmt("%s/%s", path, *sub);
123123- if ((dir = opendir(name)) == NULL) {
123123+ if (!(dir = opendir(name))) {
124124 if (errno == ENOENT)
125125 continue;
126126 error_errno("cannot opendir %s", name);
+5-5
builtin/pack-redundant.c
···101101 oidread(&new_item->oid, oid);
102102 new_item->next = NULL;
103103104104- if (after != NULL) {
104104+ if (after) {
105105 new_item->next = after->next;
106106 after->next = new_item;
107107 if (after == list->back)
···157157 if (cmp > 0) /* not in list, since sorted */
158158 return prev;
159159 if (!cmp) { /* found */
160160- if (prev == NULL) {
160160+ if (!prev) {
161161 if (hint != NULL && hint != list->front) {
162162 /* we don't know the previous element */
163163 hint = NULL;
···219219 struct pack_list *ret;
220220 const struct pack_list *pl;
221221222222- if (A == NULL)
222222+ if (!A)
223223 return NULL;
224224225225 pl = B;
···317317 struct pack_list *subset;
318318 size_t ret = 0;
319319320320- if (pl == NULL)
320320+ if (!pl)
321321 return 0;
322322323323 while ((subset = pl->next)) {
···611611 while (*(argv + i) != NULL)
612612 add_pack_file(*(argv + i++));
613613614614- if (local_packs == NULL)
614614+ if (!local_packs)
615615 die("Zero packs found!");
616616617617 load_all_objects();
···476476477477 /* name(s) */
478478 s = strpbrk(sb.buf, flag_chars);
479479- if (s == NULL)
479479+ if (!s)
480480 s = help;
481481482482 if (s - sb.buf == 1) /* short option only */
···8888 const struct string_list_item *item)
8989{
9090 int matched = 0;
9191- if (item->util == NULL) {
9191+ if (!item->util) {
9292 if (!wildmatch(item->string, refname, 0))
9393 matched = 1;
9494 } else {
+2-2
mailinfo.c
···698698 continue;
699699 }
700700 last_nonblank = c;
701701- if (first_nonblank == NULL)
701701+ if (!first_nonblank)
702702 first_nonblank = c;
703703 if (*c == '-') {
704704 in_perforation = 1;
···10941094 */
10951095 lines = strbuf_split(line, '\n');
10961096 for (it = lines; (sb = *it); it++) {
10971097- if (*(it + 1) == NULL) /* The last line */
10971097+ if (!*(it + 1)) /* The last line */
10981098 if (sb->buf[sb->len - 1] != '\n') {
10991099 /* Partial line, save it for later. */
11001100 strbuf_addbuf(&prev, sb);
+7-7
mailmap.c
···7777 struct mailmap_entry *me;
7878 struct string_list_item *item;
79798080- if (old_email == NULL) {
8080+ if (!old_email) {
8181 old_email = new_email;
8282 new_email = NULL;
8383 }
···9292 item->util = me;
9393 }
94949595- if (old_name == NULL) {
9595+ if (!old_name) {
9696 debug_mm("mailmap: adding (simple) entry for '%s'\n", old_email);
97979898 /* Replace current name and new email for simple entry */
···123123 char *left, *right, *nstart, *nend;
124124 *name = *email = NULL;
125125126126- if ((left = strchr(buffer, '<')) == NULL)
126126+ if (!(left = strchr(buffer, '<')))
127127 return NULL;
128128- if ((right = strchr(left+1, '>')) == NULL)
128128+ if (!(right = strchr(left + 1, '>')))
129129 return NULL;
130130 if (!allow_empty_email && (left+1 == right))
131131 return NULL;
···153153 if (buffer[0] == '#')
154154 return;
155155156156- if ((name2 = parse_name_and_email(buffer, &name1, &email1, 0)) != NULL)
156156+ if ((name2 = parse_name_and_email(buffer, &name1, &email1, 0)))
157157 parse_name_and_email(name2, &name2, &email2, 1);
158158159159 if (email1)
···320320 (int)*emaillen, debug_str(*email));
321321322322 item = lookup_prefix(map, *email, *emaillen);
323323- if (item != NULL) {
323323+ if (item) {
324324 me = (struct mailmap_entry *)item->util;
325325 if (me->namemap.nr) {
326326 /*
···334334 item = subitem;
335335 }
336336 }
337337- if (item != NULL) {
337337+ if (item) {
338338 struct mailmap_info *mi = (struct mailmap_info *)item->util;
339339 if (mi->name == NULL && mi->email == NULL) {
340340 debug_mm("map_user: -- (no simple mapping)\n");
+2-2
merge-ort.c
···20682068 * to ensure that's the case.
20692069 */
20702070 c_info = strmap_get(collisions, new_path);
20712071- if (c_info == NULL)
20712071+ if (!c_info)
20722072 BUG("c_info is NULL");
2073207320742074 /*
···46404640 }
4641464146424642 merged_merge_bases = pop_commit(&merge_bases);
46434643- if (merged_merge_bases == NULL) {
46434643+ if (!merged_merge_bases) {
46444644 /* if there is no common ancestor, use an empty tree */
46454645 struct tree *tree;
46464646
+6-6
merge-recursive.c
···8282{
8383 struct dir_rename_entry key;
84848585- if (dir == NULL)
8585+ if (!dir)
8686 return NULL;
8787 hashmap_entry_init(&key.ent, strhash(dir));
8888 key.dir = dir;
···19901990 * renamed means the root directory can never be renamed -- because
19911991 * the root directory always exists).
19921992 */
19931993- if (end_of_old == NULL)
19931993+ if (!end_of_old)
19941994 return; /* Note: *old_dir and *new_dir are still NULL */
1995199519961996 /*
19971997 * If new_path contains no directory (end_of_new is NULL), then we
19981998 * have a rename of old_path's directory to the root directory.
19991999 */
20002000- if (end_of_new == NULL) {
20002000+ if (!end_of_new) {
20012001 *old_dir = xstrndup(old_path, end_of_old - old_path);
20022002 *new_dir = xstrdup("");
20032003 return;
···21162116 * to ensure that's the case.
21172117 */
21182118 collision_ent = collision_find_entry(collisions, new_path);
21192119- if (collision_ent == NULL)
21192119+ if (!collision_ent)
21202120 BUG("collision_ent is NULL");
2121212121222122 /*
···29962996 const struct rename *re;
29972997 int i;
2998299829992999- if (rename == NULL)
29992999+ if (!rename)
30003000 return;
3001300130023002 for (i = 0; i < rename->nr; i++) {
···36053605 }
3606360636073607 merged_merge_bases = pop_commit(&merge_bases);
36083608- if (merged_merge_bases == NULL) {
36083608+ if (!merged_merge_bases) {
36093609 /* if there is no common ancestor, use an empty tree */
36103610 struct tree *tree;
36113611
+1-1
object-file.c
···17281728 die(_("loose object %s (stored in %s) is corrupt"),
17291729 oid_to_hex(repl), path);
1730173017311731- if ((p = has_packed_and_bad(r, repl)) != NULL)
17311731+ if ((p = has_packed_and_bad(r, repl)))
17321732 die(_("packed object %s (stored in %s) is corrupt"),
17331733 oid_to_hex(repl), p->pack_name);
17341734 obj_read_unlock();
+7-7
pack-bitmap.c
···111111 struct ewah_bitmap *parent;
112112 struct ewah_bitmap *composed;
113113114114- if (st->xor == NULL)
114114+ if (!st->xor)
115115 return st->root;
116116117117 composed = ewah_pool_new();
···279279 if (xor_offset > 0) {
280280 xor_bitmap = recent_bitmaps[(i - xor_offset) % MAX_XOR_OFFSET];
281281282282- if (xor_bitmap == NULL)
282282+ if (!xor_bitmap)
283283 return error("Invalid XOR offset in bitmap pack index");
284284 }
285285···728728 if (!or_with)
729729 return 0;
730730731731- if (*base == NULL)
731731+ if (!*base)
732732 *base = ewah_to_bitmap(or_with);
733733 else
734734 bitmap_or_ewah(*base, or_with);
···771771 * Best case scenario: We found bitmaps for all the roots,
772772 * so the resulting `or` bitmap has the full reachability analysis
773773 */
774774- if (not_mapped == NULL)
774774+ if (!not_mapped)
775775 return base;
776776777777 roots = not_mapped;
···805805 struct include_data incdata;
806806 struct bitmap_show_data show_data;
807807808808- if (base == NULL)
808808+ if (!base)
809809 base = bitmap_new();
810810811811 incdata.bitmap_git = bitmap_git;
···12991299 reset_revision_walk();
13001300 revs->ignore_missing_links = 0;
1301130113021302- if (haves_bitmap == NULL)
13021302+ if (!haves_bitmap)
13031303 BUG("failed to perform bitmap walk");
13041304 }
13051305···16981698 result = ewah_to_bitmap(bm);
16991699 }
1700170017011701- if (result == NULL)
17011701+ if (!result)
17021702 die("Commit %s doesn't have an indexed bitmap", oid_to_hex(&root->oid));
1703170317041704 revs->tag_objects = 1;
+1-1
packfile.c
···116116117117 if (idx_size < 4 * 256 + hashsz + hashsz)
118118 return error("index file %s is too small", path);
119119- if (idx_map == NULL)
119119+ if (!idx_map)
120120 return error("empty data");
121121122122 if (hdr->idx_signature == htonl(PACK_IDX_SIGNATURE)) {
+1-1
path.c
···733733 struct strbuf user_path = STRBUF_INIT;
734734 const char *to_copy = path;
735735736736- if (path == NULL)
736736+ if (!path)
737737 goto return_null;
738738739739 if (skip_prefix(path, "%(prefix)/", &path))
+1-1
prio-queue.c
···1919{
2020 int i, j;
21212222- if (queue->compare != NULL)
2222+ if (queue->compare)
2323 BUG("prio_queue_reverse() on non-LIFO queue");
2424 for (i = 0; i < (j = (queue->nr - 1) - i); i++)
2525 swap(queue, i, j);
+1-1
promisor-remote.c
···8484 struct promisor_remote *r,
8585 struct promisor_remote *previous)
8686{
8787- if (r->next == NULL)
8787+ if (!r->next)
8888 return;
89899090 if (previous)
+3-3
ref-filter.c
···12611261 * ":" means no format is specified, and use the default.
12621262 */
12631263 formatp = strchr(atomname, ':');
12641264- if (formatp != NULL) {
12641264+ if (formatp) {
12651265 formatp++;
12661266 parse_date_format(formatp, &date_mode);
12671267 }
···15091509 int i;
15101510 for (i = 0; i < used_atom_cnt; i++) {
15111511 struct atom_value *v = &val[i];
15121512- if (v->s == NULL)
15121512+ if (!v->s)
15131513 v->s = xstrdup("");
15141514 }
15151515}
···1619161916201620 while (remaining-- > 0) {
16211621 char *p = strrchr(start, '/');
16221622- if (p == NULL) {
16221622+ if (!p) {
16231623 free((char *)to_free);
16241624 return xstrdup("");
16251625 } else
+1-1
refs/ref-cache.c
···134134 r = bsearch(&key, dir->entries, dir->nr, sizeof(*dir->entries),
135135 ref_entry_cmp_sslice);
136136137137- if (r == NULL)
137137+ if (!r)
138138 return -1;
139139140140 return r - dir->entries;
+1-1
reftable/stack_test.c
···3535 DIR *dir = opendir(dirname);
3636 int len = 0;
3737 struct dirent *d;
3838- if (dir == NULL)
3838+ if (!dir)
3939 return 0;
40404141 while ((d = readdir(dir))) {
+2-2
reftable/tree.c
···1616 int insert)
1717{
1818 int res;
1919- if (*rootp == NULL) {
1919+ if (!*rootp) {
2020 if (!insert) {
2121 return NULL;
2222 } else {
···50505151void tree_free(struct tree_node *t)
5252{
5353- if (t == NULL) {
5353+ if (!t) {
5454 return;
5555 }
5656 if (t->left) {
+6-6
reftable/writer.c
···183183 struct tree_node *node = tree_search(&want, &w->obj_index_tree,
184184 &obj_index_tree_node_compare, 0);
185185 struct obj_index_tree_node *key = NULL;
186186- if (node == NULL) {
186186+ if (!node) {
187187 struct obj_index_tree_node empty = OBJ_INDEX_TREE_NODE_INIT;
188188 key = reftable_malloc(sizeof(struct obj_index_tree_node));
189189 *key = empty;
···222222223223 strbuf_reset(&w->last_key);
224224 strbuf_addbuf(&w->last_key, &key);
225225- if (w->block_writer == NULL) {
225225+ if (!w->block_writer) {
226226 writer_reinit_block_writer(w, reftable_record_type(rec));
227227 }
228228···263263 };
264264 int err = 0;
265265266266- if (ref->refname == NULL)
266266+ if (!ref->refname)
267267 return REFTABLE_API_ERROR;
268268 if (ref->update_index < w->min_update_index ||
269269 ref->update_index > w->max_update_index)
···336336 if (log->value_type == REFTABLE_LOG_DELETION)
337337 return reftable_writer_add_log_verbatim(w, log);
338338339339- if (log->refname == NULL)
339339+ if (!log->refname)
340340 return REFTABLE_API_ERROR;
341341342342 input_log_message = log->value.update.message;
···545545 uint8_t typ = 0;
546546 int err = 0;
547547548548- if (w->block_writer == NULL)
548548+ if (!w->block_writer)
549549 return 0;
550550551551 typ = block_writer_type(w->block_writer);
···694694695695static int writer_flush_block(struct reftable_writer *w)
696696{
697697- if (w->block_writer == NULL)
697697+ if (!w->block_writer)
698698 return 0;
699699 if (w->block_writer->entries == 0)
700700 return 0;
+1-1
rerere.c
···591591 else if (conflict_type == RESOLVED) {
592592 struct string_list_item *it;
593593 it = string_list_lookup(merge_rr, (const char *)e->name);
594594- if (it != NULL) {
594594+ if (it) {
595595 free_rerere_id(it);
596596 it->util = RERERE_RESOLVED;
597597 }
+2-2
revision.c
···28332833 }
28342834 strvec_clear(&prune_data);
2835283528362836- if (revs->def == NULL)
28362836+ if (!revs->def)
28372837 revs->def = opt ? opt->def : NULL;
28382838 if (opt && opt->tweak)
28392839 opt->tweak(revs, opt);
···36523652 return rewrite_one_ok;
36533653 if (!p->parents)
36543654 return rewrite_one_noparents;
36553655- if ((p = one_relevant_parent(revs, p->parents)) == NULL)
36553655+ if (!(p = one_relevant_parent(revs, p->parents)))
36563656 return rewrite_one_ok;
36573657 *pp = p;
36583658 }
···1029102910301030 /* Create temporary file in the same directory as the original */
10311031 tail = strrchr(file, '/');
10321032- if (tail != NULL)
10321032+ if (tail)
10331033 strbuf_add(&filename_template, file, tail - file + 1);
10341034 strbuf_addstr(&filename_template, "git-interpret-trailers-XXXXXX");
10351035
+1-1
transport.c
···438438 args.self_contained_and_connected;
439439 data->options.connectivity_checked = args.connectivity_checked;
440440441441- if (refs == NULL)
441441+ if (!refs)
442442 ret = -1;
443443 if (report_unmatched_refs(to_fetch, nr_heads))
444444 ret = -1;
+1-1
wildmatch.c
···113113 /* Trailing "**" matches everything. Trailing "*" matches
114114 * only if there are no more slash characters. */
115115 if (!match_slash) {
116116- if (strchr((char*)text, '/') != NULL)
116116+ if (strchr((char *)text, '/'))
117117 return WM_NOMATCH;
118118 }
119119 return WM_MATCH;