rem: if (state->curr_aperture == 0) break;
add: if (state->changed == 0) break; state->changed = 0;
context: parse_gerb(FILE *fd){    gerb_state_t *state = NULL;    gerb_image_t *image = NULL;    gerb_net_t *curr_net = NULL;    char read;    double x_scale, y_scale;        state = (gerb_state_t *)malloc(sizeof(gerb_state_t));    if (state == NULL)	err(1, "malloc state failed\n");    bzero((void *)state, sizeof(gerb_state_t));    image = new_image(image);    if (image == NULL)	err(1, "malloc image failed\n");    curr_net = image->netlist;    while ((read = (char)fgetc(fd)) != EOF) {	switch (read) {	case 'G':	    parse_G_code(fd, state, image->format);	    break;	case 'D':	    parse_D_code(fd, state);	    break;	case 'M':	    switch(parse_M_code(fd)) {	    case 1 :	    case 2 :	    case 3 :		free(state);		return image;		break;	    default:		err(1, "Strange M code found.\n");	    }	    break;	case 'X':	    state->curr_x = read_int(fd);	    break;	case 'Y':	    state->curr_y = read_int(fd);	    break;	case 'I':	    state->arc_start_x = read_int(fd);	    break;	case 'J':	    state->arc_start_y = read_int(fd);	    break;	case '%':	    parse_rs274x(fd, image);	    while (fgetc(fd) != '%');	    break;	case '*':	    if (state->curr_aperture == 0) break;	    curr_net->next = (gerb_net_t *)malloc(sizeof(gerb_net_t));	    curr_net = curr_net->next;	    bzero((void *)curr_net, sizeof(gerb_net_t));	    	    if (image && image->format ){		x_scale = pow(10.0, (double)image->format->x_dec);		y_scale = pow(10.0, (double)image->format->y_dec);	    }	    	    curr_net->start_x = (double)state->prev_x / x_scale;	    curr_net->start_y = (double)state->prev_y / y_scale;	    curr_net->stop_x = (double)state->curr_x / x_scale;	    curr_net->stop_y = (double)state->curr_y / y_scale;	    curr_net->arc_start_x = (double)state->arc_start_x / x_scale;	    curr_net->arc_start_y = (double)state->arc_start_y / y_scale;#ifdef EAGLECAD_KLUDGE	    if ( (state->arc_start_x == 0) && (state->arc_start_y == 0) )		curr_net->interpolation = LINEARx1;	    else		curr_net->interpolation = state->interpolation;#else	    curr_net->interpolation = state->interpolation;#endif	    state->arc_start_x = 0.0;	    state->arc_start_y = 0.0;	    curr_net->aperture = state->curr_aperture;	    curr_net->aperture_state = state->aperture_state;	    	    /*	     * Find min and max of image	     */	    if (image->info->min_x == 0.0 || 		image->info->min_x > curr_net->stop_x)		image->info->min_x = curr_net->stop_x;	    if (image->info->min_y == 0.0 || 		image->info->min_y > curr_net->stop_y)		image->info->min_y = curr_net->stop_y;	    if (image->info->max_x < curr_net->stop_x)		image->info->max_x = curr_net->stop_x;	    if (image->info->max_y < curr_net->stop_x)		image->info->max_y = curr_net->stop_y;	    	    state->prev_x = state->curr_x;	    state->prev_y = state->curr_y;	    	    break;	case 10 :   /* White space */	case 13 :	case ' ' :	case '\t' :	    break;	default:	    fprintf(stderr, "Found unknown character (whitespace?) %c[%d]\n", read, read);	}    }        fprintf(stderr, "File is missing gerber End-Of-File\n");        return image;} /* parse_gerb */