URL:
  <http://gna.org/bugs/?15412>

                 Summary: Duff assertion in city_unit_unhappiness()
                 Project: Freeciv
            Submitted by: jtn
            Submitted on: Thursday 18/02/10 at 01:27
                Category: None
                Severity: 2 - Minor
                Priority: 1 - Later
                  Status: Ready For Test
             Assigned to: jtn
        Originator Email: 
             Open/Closed: Open
                 Release: 2.2.0-RC1
         Discussion Lock: Any
        Operating System: None
         Planned Release: 

    _______________________________________________________

Details:

Code looks like:


int city_unit_unhappiness(..., int *free_unhappy)
{
  ...
  if (... || !free_unhappy || ...) {
    return 0;
  }
  assert(free_unhappy >= 0);
  ...
}


The assertion will probably never fire since it's the pointer being compared
to 0, not its contents, so this is harmless. (Unless there's some platform
where likely pointers look like negative numbers in such a comparison, in
which case it'll fire spuriously.)

Attached patch fixes to presumed intent.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thursday 18/02/10 at 01:27  Name: S2_2-free_unhappy-assertion.diff 
Size: 393B   By: jtn

<http://gna.org/bugs/download.php?file_id=8156>

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?15412>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to