[rfk-dev] compiling rfk for 32-bit x86

David Wolever david at wolever.net
Sun Nov 18 21:37:21 PST 2012


Alright, found the bug. Here's a reasonable patch to fix it (although I can't say with certainty that it's definitely the most reasonable):

diff --git a/src/robotfindskitten.c b/src/robotfindskitten.c
index 7074273..4afd34e 100644
--- a/src/robotfindskitten.c
+++ b/src/robotfindskitten.c
@@ -354,7 +354,7 @@ void init ( unsigned int num ) {
        unsigned int i, j, temp;
 
        /* allocate memory */
-       if ( ! ( state.items = calloc ( num, sizeof ( screen_object ) ) ) ) {
+       if ( ! ( state.items = calloc ( num + 2, sizeof ( screen_object ) ) ) ) {
                fprintf ( stderr, "Cannot malloc.\n" );
                exit ( EXIT_FAILURE );
        }

The issue was introduced in:
commit e4523de30933e3095436dabb0fc7c7df7e6bbf38
Author: Eric S. Raymond <esr at thyrsus.com>
Date:   Wed Oct 31 10:22:02 2012 -0400

    All objects, including robot and kitten, now live in the same items array.
    
    Soon this will enable more interesting resizing behavior.


And has been tested (albeit briefly, and only by checking the output of valgrind) against:
commit 42bc0c234cf3e71a8f02849e073da502f8be1e5e
Author: David Griffith <dave at 661.org>
Date:   Thu Nov 8 20:15:43 2012 -0800

    Fixed problem with up-down movement resetting fromright to false.
    The practical effect of this is if you move left and then up to touch
    something, the animation will now show robot approaching kitten from the
    left.  Prior to this, if you approach from the top of bottom, the
    animation would always put robot on the left.


On 2012-11-18, at 5:14 PM, David Griffith wrote:

> 
> Has anyone recently looked at why rfk keeps crashing on 32-bit x86?  I'm 
> halfway considering rewriting the thing from scratch.
> 
> -- 
> David Griffith
> dgriffi at cs.csubak.edu
> 
> A: Because it fouls the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing in e-mail?
> _______________________________________________
> rfk-dev mailing list
> rfk-dev at robotfindskitten.org
> http://robotfindskitten.org/cgi-bin/mailman/listinfo/rfk-dev

--
phone: (416) 906-0403
pgp: B230230D


More information about the rfk-dev mailing list