]> granicus.if.org Git - nethack/commitdiff
remove redundant null-check on christen_orc()
authorSHIRAKATA Kentaro <argrath@ub32.org>
Tue, 8 Feb 2022 18:17:53 +0000 (03:17 +0900)
committerSHIRAKATA Kentaro <argrath@ub32.org>
Fri, 11 Feb 2022 07:52:50 +0000 (16:52 +0900)
rndorcname() returns buf2 itself, so orcname is never NULL.

src/do_name.c

index 392a7993add7e41c84910faa5d7aa59b6ec0bc0f..35daad658fd963ac5bf85058fe12e3e971a87b76 100644 (file)
@@ -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;
         }