summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/acr.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-19 13:22:30 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-19 13:22:30 +0000
commite849fa33997fbae91d6344ad6e0bedb1cc9f30bd (patch)
tree55fb990f30885c6f6b3701ff870418c64e16c054 /crawl-ref/source/acr.cc
parentcf8a26d0518081b76c4fa7083e678a52fad73a17 (diff)
downloadcrawl-ref-e849fa33997fbae91d6344ad6e0bedb1cc9f30bd.tar.gz
crawl-ref-e849fa33997fbae91d6344ad6e0bedb1cc9f30bd.zip
And a few more gotos, this time in dgamelaunch code.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9130 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/acr.cc')
-rw-r--r--crawl-ref/source/acr.cc24
1 files changed, 14 insertions, 10 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index d04336b359..f0d0feeb78 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -2699,6 +2699,14 @@ static void _show_message_line(std::string line)
}
}
+static void _kill_messaging(FILE *mf)
+{
+ if (mf)
+ fclose(mf);
+ SysEnv.have_messages = false;
+ Options.messaging = false;
+}
+
static void _read_each_message()
{
bool say_got_msg = true;
@@ -2707,7 +2715,8 @@ static void _read_each_message()
{
mprf(MSGCH_ERROR, "Couldn't read %s: %s", SysEnv.messagefile.c_str(),
strerror(errno));
- goto kill_messaging;
+ _kill_messaging(mf);
+ return;
}
// Read messages, code borrowed from the SIMPLEMAIL patch.
@@ -2717,7 +2726,8 @@ static void _read_each_message()
{
mprf(MSGCH_ERROR, "Failed to lock %s: %s", SysEnv.messagefile.c_str(),
strerror(errno));
- goto kill_messaging;
+ _kill_messaging(mf);
+ return;
}
while (fgets(line, sizeof line, mf))
@@ -2744,7 +2754,8 @@ static void _read_each_message()
mprf(MSGCH_ERROR, "Failed to lock %s: %s",
SysEnv.messagefile.c_str(),
strerror(errno));
- goto kill_messaging;
+ _kill_messaging(mf);
+ return;
}
}
if (!lock_file_handle(mf, F_WRLCK))
@@ -2759,13 +2770,6 @@ static void _read_each_message()
fclose(mf);
SysEnv.have_messages = false;
- return;
-
-kill_messaging:
- if (mf)
- fclose(mf);
- SysEnv.have_messages = false;
- Options.messaging = false;
}
static void _read_messages()