From 7c1dba3f0bb2db6e1cb975ec15ca847334a445dc Mon Sep 17 00:00:00 2001 From: SHIRAKATA Kentaro Date: Wed, 9 Feb 2022 03:17:53 +0900 Subject: [PATCH] remove redundant null-check on christen_orc() rndorcname() returns buf2 itself, so orcname is never NULL. --- src/do_name.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/do_name.c b/src/do_name.c index 392a7993a..35daad658 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -2415,6 +2415,7 @@ christen_orc(struct monst *mtmp, const char *gang, const char *other) char buf[BUFSZ], buf2[BUFSZ], *orcname; orcname = rndorcname(buf2); + /* orcname is never NULL */ sz = (int) strlen(orcname); if (gang) sz += (int) (strlen(gang) + sizeof " of " - sizeof ""); @@ -2425,11 +2426,11 @@ christen_orc(struct monst *mtmp, const char *gang, const char *other) char gbuf[BUFSZ]; boolean nameit = FALSE; - if (gang && orcname) { + if (gang) { Sprintf(buf, "%s of %s", upstart(orcname), upstart(strcpy(gbuf, gang))); nameit = TRUE; - } else if (other && orcname) { + } else if (other) { Sprintf(buf, "%s%s", upstart(orcname), other); nameit = TRUE; } -- 2.50.1