From: Junio C Hamano Date: Mon, 2 May 2022 17:06:00 +0000 (-0700) Subject: Merge branch 'ep/maint-equals-null-cocci' for maint-2.35 X-Git-Tag: v2.37.0-rc0~68^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2b0a58d164b0642be3eeb476fecd28114445cdd5;p=thirdparty%2Fgit.git Merge branch 'ep/maint-equals-null-cocci' for maint-2.35 * ep/maint-equals-null-cocci: tree-wide: apply equals-null.cocci contrib/coccinnelle: add equals-null.cocci --- 2b0a58d164b0642be3eeb476fecd28114445cdd5 diff --cc branch.c index 5d20a2e848,fc49f57d77..bc46adfa25 --- a/branch.c +++ b/branch.c @@@ -405,8 -302,8 +405,8 @@@ void create_branch(struct repository *r break; } - if ((commit = lookup_commit_reference(r, &oid)) == NULL) + if (!(commit = lookup_commit_reference(r, &oid))) - die(_("Not a valid branch point: '%s'."), start_name); + die(_("not a valid branch point: '%s'"), start_name); oidcpy(&oid, &commit->object.oid); if (reflog) diff --cc xdiff/xprepare.c index 4527a4a07c,4c0561ce1f..105752758f --- a/xdiff/xprepare.c +++ b/xdiff/xprepare.c @@@ -181,14 -181,18 +181,14 @@@ static int xdl_prepare_ctx(unsigned in if (!(recs = (xrecord_t **) xdl_malloc(narec * sizeof(xrecord_t *)))) goto abort; - if (XDF_DIFF_ALG(xpp->flags) == XDF_HISTOGRAM_DIFF) - hbits = hsize = 0; - else { - hbits = xdl_hashbits((unsigned int) narec); - hsize = 1 << hbits; - if (!(rhash = (xrecord_t **) xdl_malloc(hsize * sizeof(xrecord_t *)))) - goto abort; - memset(rhash, 0, hsize * sizeof(xrecord_t *)); - } + hbits = xdl_hashbits((unsigned int) narec); + hsize = 1 << hbits; + if (!(rhash = (xrecord_t **) xdl_malloc(hsize * sizeof(xrecord_t *)))) + goto abort; + memset(rhash, 0, hsize * sizeof(xrecord_t *)); nrec = 0; - if ((cur = blk = xdl_mmfile_first(mf, &bsize)) != NULL) { + if ((cur = blk = xdl_mmfile_first(mf, &bsize))) { for (top = blk + bsize; cur < top; ) { prev = cur; hav = xdl_hash_record(&cur, top, xpp->flags);