[Freeciv-Dev] [bug #13802] [Patch] Invalid iterator for NULL hash tables

2009-09-03 Thread Marko Lindqvist

Update of bug #13802 (project freeciv):

  Status:  Ready For Test => Fixed  
 Assigned to:   mbook => cazfi  
 Open/Closed:Open => Closed 


___

Reply to this item at:

  

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


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


[Freeciv-Dev] [bug #13802] [Patch] Invalid iterator for NULL hash tables

2009-06-29 Thread Madeline Book

Follow-up Comment #2, bug #13802 (project freeciv):

> It is really needed? Couldn't it be performed by adding
> a test in the iterating marco like: if (NULL != hash)?

If you mean in the specific iteration macros like
hash_keys_iterate, this would need to be repeated each
time a new macro like that is defined, and I wanted to
avoid the situation where the same code is duplicated
in the headers every time. One design goal of the
generic_iterate macro is to reduce the definition to
only the things that are different.

If you mean to put the NULL check in the generic_
iterate macro itself, it would have to be a check
on the iterator pointer, since the extra init
arguments are passed via macro varargs, and could
be completely absent or more than 1 (i.e. there is
no way to put them in an if-expression).

One reason I did not allow NULL iterator pointers is
so that I would not have to put NULL checks in all of
the iterator_*() functions and also in any code that
would use the init function outside of the generic_
iterate macro.

Iterator pointers are somewhat special in that the
memory is guaranteed to be on the stack; it is never
NULL. If we decide to use NULL iterator pointers in
one place, we would have to do away with this nice
property and assume that iterators could be NULL
almost everywhere.

We would not need the iterator.c file, but then we
would need a lot more NULL checks everywhere else, so
purely from a number of lines of code standpoint I
don't think we gain anything.

The functions in iterator.c also provide some "boiler-
plate" code which can be copied and adapted for new
iterator implementations (albeit the sizeof function
is missing).

Is that acceptable justification?



イエスかノーかはっきり言ってください。

___

Reply to this item at:

  

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


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


[Freeciv-Dev] [bug #13802] [Patch] Invalid iterator for NULL hash tables

2009-06-29 Thread pepeto

Follow-up Comment #1, bug #13802 (project freeciv):

It is really needed? Couldn't it be performed by adding a test in the
iterating marco like: if (NULL != hash)?


___

Reply to this item at:

  

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


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


[Freeciv-Dev] [bug #13802] [Patch] Invalid iterator for NULL hash tables

2009-06-27 Thread Madeline Book

URL:
  

 Summary: [Patch] Invalid iterator for NULL hash tables
 Project: Freeciv
Submitted by: mbook
Submitted on: Sunday 06/28/2009 at 05:25
Category: general
Severity: 3 - Normal
Priority: 5 - Normal
  Status: Ready For Test
 Assigned to: mbook
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Release: 
Operating System: None

___

Details:

Making use of the 13801, trying to iterate over
a NULL hash table will just iterate over nothing,
instead of crashing.



私が無にぶつかった。



___

File Attachments:


---
Date: Sunday 06/28/2009 at 05:25  Name: use_invalid_hash_iter.diff  Size: 1kB
  By: mbook



___

Reply to this item at:

  

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


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