Fix crashing color_ostream::printerr due to vfprintf vs fprintf mixup.

Also enable heap clearing in gdb mode, and fix a few newlines.
develop
Alexander Gavrilov 2012-03-31 22:26:41 +04:00
parent 0f41608ed4
commit 9d6e26fa5f
3 changed files with 5 additions and 4 deletions

@ -125,7 +125,7 @@ void color_ostream::vprinterr(const char *format, va_list args)
color_value save = cur_color;
if (log_errors_to_stderr)
fprintf(stderr, format, args);
vfprintf(stderr, format, args);
color(COLOR_LIGHTRED);
vprint(format, args);

@ -41,6 +41,7 @@ case "$1" in
-g | --gdb)
shift
echo "set environment LD_PRELOAD=./hack/libdfhack.so" > gdbcmd.tmp
echo "set environment MALLOC_PERTURB_=45" >> gdbcmd.tmp
gdb $DF_GDB_OPTS -x gdbcmd.tmp ./libs/Dwarf_Fortress $*
rm gdbcmd.tmp
ret=$?

@ -500,7 +500,7 @@ static bool recover_job(color_ostream &out, ProtectedJob *pj)
pj->holder = df::building::find(pj->building_id);
if (!pj->holder)
{
out.printerr("Forgetting job %d (%s): holder building lost.",
out.printerr("Forgetting job %d (%s): holder building lost.\n",
pj->id, ENUM_KEY_STR(job_type, pj->job_copy->job_type).c_str());
forget_job(out, pj);
return true;
@ -509,7 +509,7 @@ static bool recover_job(color_ostream &out, ProtectedJob *pj)
// Check its state and postpone or cancel if invalid
if (pj->holder->jobs.size() >= 10)
{
out.printerr("Forgetting job %d (%s): holder building has too many jobs.",
out.printerr("Forgetting job %d (%s): holder building has too many jobs.\n",
pj->id, ENUM_KEY_STR(job_type, pj->job_copy->job_type).c_str());
forget_job(out, pj);
return true;
@ -532,7 +532,7 @@ static bool recover_job(color_ostream &out, ProtectedJob *pj)
{
deleteJobStruct(recovered);
out.printerr("Inconsistency: job %d (%s) already in list.",
out.printerr("Inconsistency: job %d (%s) already in list.\n",
pj->id, ENUM_KEY_STR(job_type, pj->job_copy->job_type).c_str());
return true;
}