bugFreeciv - Bugs: bug #22026, is_native_move(): missing...

 
 
Show feedback again

bug #22026: is_native_move(): missing "break" in switch statement

Submitted by:  pepeto <pepeto>
Submitted on:  Thu May 8 08:34:51 2014  
 
Category: generalSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Assigned to: pepeto <pepeto>Open/Closed: Closed
Release: trunk r24826Operating System: None
Planned Release: 2.6.0Contains string changes: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu May 15 15:01:19 2014, SVN revision 24890:

Rewrite and fix is_native_move().

Report and patch by me

See gna bug #22026.

(Browse SVN revision 24890)

pepeto <pepeto>
Project MemberIn charge of this item.
Fri May 9 07:12:05 2014, comment #3:

'const struct foo *' means a pointer to a read-only structure. The pointer can be reassigned, but you cannot write to the memory.

'struct foo *const' means a constant pointer to a structure which can modified.

If we were using the incorrect alternative, I bet that gcc would have complained. So, it is safe to define this variable at the function scope.

pepeto <pepeto>
Project MemberIn charge of this item.
Fri May 9 05:45:47 2014, comment #2:

This code is much cleaner than the original implementation: thank you. I'm a little worried about declaring proad a const at function scope though, as the value is changed in each iteration: should this not use a non-const struct (and extra_road_get()), or to put the declaration of proad inside the extra_type_list iteration?

Emmet Hikory <persia>
Project Member
Thu May 8 09:48:52 2014, comment #1:

Second version that additionaly pushes disembarking or leaving port outside the extra type iteration loop.

(file #20689)

pepeto <pepeto>
Project MemberIn charge of this item.
Thu May 8 08:34:51 2014, original submission:

When reading is_native_move(), I noticed that breaks were missing to separate cases in the switch statement.

The attached patch returns TRUE as soon as possible and reduce the huge number of spaces used for the indentation.

pepeto <pepeto>
Project MemberIn charge of this item.

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #20689:  is_native_move2.diff added by pepeto (5kB - text/x-diff)
file #20688:  is_native_move.diff added by pepeto (4kB - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by persia (Posted a comment)
  • -unavailable- added by pepeto (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Error: not logged in

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu May 15 15:01:34 2014pepetoStatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Mon May 12 12:51:52 2014pepetoAssigned toNone=>pepeto
    Thu May 8 09:48:52 2014pepetoAttached File-=>Added is_native_move2.diff, #20689
    Thu May 8 08:34:52 2014pepetoAttached File-=>Added is_native_move.diff, #20688
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup