Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] (PR#2333) Add function die()
Home

[Freeciv-Dev] (PR#2333) Add function die()

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#2333) Add function die()
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Sat, 16 Nov 2002 04:09:23 -0800
Reply-to: rt@xxxxxxxxxxxxxx

[rfalke - Thu Nov 14 17:41:44 2002]:

> 
> The patch replaces code like below:
> 
>      if (team_id == TEAM_NONE) {
> -      freelog(LOG_ERROR, "Impossible: Too many teams!");
> -      assert(FALSE);
> -      exit(EXIT_FAILURE);
> +      die("Impossible: Too many teams!");
>      }
> 
> with 
> +  vreal_freelog(LOG_FATAL, format, ap);
> +  assert(FALSE);
> +  exit(EXIT_FAILURE);
> 
> It simplifies the code (no longer the questions "is it LOG_ERROR or
> LOG_FATAL" "exit or abort"). And it removes one dependency for
> stdlib.h.

Looks clean to me.  This is a lot of code change, but it's all
shortening the code.

Now, there are a few places where exit(EXIT_SUCCESS) should be used
instead of die.  And AFAICT it is.  There are other places where
exit(EXIT_FAILURE) should be used without an abort (e.g., when the user
gives bad command-line input, or a file is not available, etc.).  die()
should not be used in this case either.  It's hard to tell whether this
is done or not.

jason



[Prev in Thread] Current Thread [Next in Thread]