From: Yesterday's Voyage Date: Sun, 15 Feb 2009 19:27:32 +0000 (+0000) Subject: Remove unnecessary static buffer non-NULL checks X-Git-Tag: 0.73p1~6 X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=122cb22876cad8c0a527b3ece52de2b9d4d07b61;p=cobramush.git Remove unnecessary static buffer non-NULL checks (cherry picked from commit 649633fd0006d8a97292dc83e8cd5deb65ae6d02) --- diff --git a/src/bsd.c b/src/bsd.c index c59e9ba..9d24fdc 100644 --- a/src/bsd.c +++ b/src/bsd.c @@ -2869,11 +2869,11 @@ dump_messages(DESC *d, dbref player, int isnew) (Guest(player) && !options.guest_allow)) { if (!options.login_allow) { fcache_dump(d, fcache.down_fcache, NULL); - if (cf_downmotd_msg && *cf_downmotd_msg) + if (*cf_downmotd_msg) raw_notify(player, cf_downmotd_msg); } else if (MAX_LOGINS && !under_limit) { fcache_dump(d, fcache.full_fcache, NULL); - if (cf_fullmotd_msg && *cf_fullmotd_msg) + if (*cf_fullmotd_msg) raw_notify(player, cf_fullmotd_msg); } if (!Can_Login(player)) { @@ -3766,7 +3766,7 @@ announce_connect(dbref player, int isnew, int num) } orator = player; - if (cf_motd_msg && *cf_motd_msg) { + if (*cf_motd_msg) { raw_notify(player, cf_motd_msg); } raw_notify(player, " "); diff --git a/src/division.c b/src/division.c index 46e1491..5acb970 100644 --- a/src/division.c +++ b/src/division.c @@ -1292,7 +1292,7 @@ COMMAND(cmd_power) *tbp = '\0'; notify_format(player, "Power Name : %s", power->name); - notify_format(player, "Power Aliases : %s", tbuf ? tbuf : ""); + notify_format(player, "Power Aliases : %s", tbuf); notify_format(player, "Power Type : %s", powc_list[i].name); } else notify(player, "No such power."); @@ -2672,7 +2672,7 @@ void do_list_powers(dbref player, const char *name) { safe_format(tbuf, &tbp, ", %s", pname); } *tbp = '\0'; - notify_format(player, "Powers List: %s", tbuf ? tbuf : "None."); + notify_format(player, "Powers List: %s", tbuf); } char *list_all_powers(dbref player, const char *name) { diff --git a/src/extchat.c b/src/extchat.c index fc5a1ad..08dd238 100644 --- a/src/extchat.c +++ b/src/extchat.c @@ -237,7 +237,7 @@ load_chatdb_oldstyle(FILE * fp) /* Check for **END OF DUMP*** */ fgets(buff, sizeof buff, fp); - if (!buff) + if (!*buff) do_rawlog(LT_ERR, T("CHAT: No end-of-dump marker in the chat database.")); else if (strcmp(buff, EOD) != 0) do_rawlog(LT_ERR, T("CHAT: Trailing garbage in the chat database.")); @@ -310,7 +310,7 @@ load_chatdb(FILE * fp) /* Check for **END OF DUMP*** */ fgets(buff, sizeof buff, fp); - if (!buff) + if (!*buff) do_rawlog(LT_ERR, T("CHAT: No end-of-dump marker in the chat database.")); else if (strcmp(buff, EOD) != 0) do_rawlog(LT_ERR, T("CHAT: Trailing garbage in the chat database.")); @@ -1955,7 +1955,7 @@ ok_channel_name(const char *n) strcpy(name, remove_markup(n, NULL)); - if (!name || !*name) + if (!*name) return 0; /* No leading spaces */ diff --git a/src/extmail.c b/src/extmail.c index 202b055..10aba79 100644 --- a/src/extmail.c +++ b/src/extmail.c @@ -2037,7 +2037,7 @@ load_mail(FILE * fp) if (nbuf1[0] == '0' && nbuf1[1] == '\n') { char buff[20]; fgets(buff, sizeof buff, fp); - if (!buff) + if (!*buff) do_rawlog(LT_ERR, T("MAIL: Missing end-of-dump marker in mail database.")); else if (strcmp(buff, (mail_flags & MDBF_NEW_EOD) @@ -2153,7 +2153,7 @@ load_mail(FILE * fp) { char buff[20]; fgets(buff, sizeof buff, fp); - if (!buff) + if (!*buff) do_rawlog(LT_ERR, T("MAIL: Missing end-of-dump marker in mail database.")); else if (strcmp(buff, (mail_flags & MDBF_NEW_EOD) diff --git a/src/flags.c b/src/flags.c index d239fff..b303a2d 100644 --- a/src/flags.c +++ b/src/flags.c @@ -1450,7 +1450,7 @@ set_flag(dbref player, dbref thing, const char *flag, int negate, icloc_ptr = atr_get(thing, "TRUERACE"); if(icloc_ptr) strncpy(icloc_buf, atr_value(icloc_ptr), BUFFER_LEN-1); - if(!icloc_buf) { + if(!*icloc_buf) { if(player != thing) notify(player, "That player does not have a valid TRUERACE set."); notify(thing, "You do not have a valid TRUERACE set. Contact an administrator."); @@ -1465,7 +1465,7 @@ set_flag(dbref player, dbref thing, const char *flag, int negate, memset(icloc_buf, '\0', BUFFER_LEN); if(icloc_ptr) strncpy(icloc_buf, atr_value(icloc_ptr), BUFFER_LEN-1); - if(!icloc_buf) { + if(!*icloc_buf) { if(player != thing) notify(player, "That player has an invalid RP location set."); notify(thing, "You have an invalid RP location set. Contact an administrator.");