Ignore:
Timestamp:
Jul 18, 2008, 12:31:35 PM (17 years ago)
Author:
ole
Message:

Verified that pointer fix works on Linux. All tests pass and boxing day example appears to work (inasmuch as it doesn't segfault anymore).
I have not looked for memory leaks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/urs_ext.c

    r5528 r5529  
    6363    int num_ts;
    6464   
    65     printf("Checkpoint 1 for urs2sts_ext.c\n");
     65    //printf("Checkpoint 1 for urs2sts_ext.c\n");
    6666
    6767    // Convert Python arguments to C
     
    106106    }
    107107
    108     printf("Checkpoint 2 for urs2sts_ext.c\n");   
     108    //printf("Checkpoint 2 for urs2sts_ext.c\n");   
    109109    for (i = 0; i < numSrc; i++)
    110110    {
    111         printf("Checkpoint 2.1 for urs2sts_ext.c\n");       
    112111       
    113112        fname = PyList_GetItem(filenames, i);
     
    122121        {
    123122            printf("ERROR: Memory for muxFileNameArray could not be allocated.\n");
    124             exit(-1);
    125         }
    126     }
    127 
    128     printf("Checkpoint 3 for urs2sts_ext.c\n");       
     123            return NULL;
     124        }
     125    }
     126
     127    //printf("Checkpoint 3 for urs2sts_ext.c\n");       
    129128    if (file_params->nd != 1 || file_params->descr->type_num != PyArray_DOUBLE)
    130129    {
     
    134133    }
    135134
    136     printf("Checkpoint 4 for urs2sts_ext.c\n");       
     135    //printf("Checkpoint 4 for urs2sts_ext.c\n");       
    137136    // Create array for weights which are passed to read_mux2
    138137    weights = (float*) malloc((int)numSrc*sizeof(float));
     
    142141    }
    143142   
    144     printf("Checkpoint 5 for urs2sts_ext.c\n");           
     143    //printf("Checkpoint 5 for urs2sts_ext.c\n");           
    145144    // Read in mux2 data from file
    146145    cdata = _read_mux2((int)numSrc, muxFileNameArray, weights, (double*)file_params->data, (int)verbose);
    147146
    148     printf("Checkpoint 6 for urs2sts_ext.c\n");               
     147    //printf("Checkpoint 6 for urs2sts_ext.c\n");               
    149148    // Allocate space for return vector
    150149    nsta0 = (int)*(double*)(file_params->data + 0*file_params->strides[0]);
     
    152151    nt = (int)*(double*)(file_params->data + 2*file_params->strides[0]);
    153152
    154     printf("Checkpoint 7 for urs2sts_ext.c\n");                   
     153    //printf("Checkpoint 7 for urs2sts_ext.c\n");                   
    155154    // Find min and max start times of all gauges
    156155    start_tstep = nt + 1;
     
    168167    }
    169168
    170     printf("Checkpoint 8 for urs2sts_ext.c\n");                       
     169    //printf("Checkpoint 8 for urs2sts_ext.c\n");                       
    171170    if ((start_tstep > nt) | (finish_tstep < 0))
    172171    {
     
    191190    }
    192191
    193     printf("Checkpoint 9 for urs2sts_ext.c\n");                           
     192    //printf("Checkpoint 9 for urs2sts_ext.c\n");                           
    194193    // Each gauge begins and ends recording at different times. When a gauge is
    195194    // not recording but at least one other gauge is. Pad the non-recording gauge
     
    221220    }
    222221
    223     printf("Checkpoint 10 for urs2sts_ext.c\n");                               
     222    //printf("Checkpoint 10 for urs2sts_ext.c\n");                               
    224223    free(weights);
    225224   
    226     /*
    227     for (i = 0; i < numSrc; ++i)
    228     {
    229         free(muxFileNameArray[i]);
    230         }*/
     225    // Free filename array, but not independent Python strings
     226    // FIXME(Ole): Do we need to update a reference counter in this case?
    231227    free(muxFileNameArray);
    232228   
     
    237233    free(cdata);
    238234
    239     printf("Checkpoint 11 for urs2sts_ext.c\n");                                   
     235    //printf("Checkpoint 11 for urs2sts_ext.c\n");                                   
    240236    return  PyArray_Return(pydata);
    241237}
Note: See TracChangeset for help on using the changeset viewer.