29 Aug 2001 welisc   » (Journeyer)

Spent half the afternoon tracking down a mysterious segfault caused by one little line:

static char *sort_phen1 = NULL,*sort_phen2 = NULL;
static int initialised = FALSE;

/* lots of code */

static int sort_comp_phen(Ind *s1, Ind *s2)

char *sort_phen1,*sort_phen2;
if (!initialised){
sort_phen1 = chrom_string();
sort_phen2 = chrom_string();
initialised = TRUE;

strcpy(sort_phen1,chrom_phenotype(s1->chrom)); strcpy(sort_phen2,chrom_phenotype(s2->chrom));
return strcmp(sort_phen1,sort_phen2);


Strange how you can never see something that's staring you in the face. Compiling with the -Wshadow flag would've caught it.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!