copy_and_insert_bogie (sonar_sensor_data *ssd, sonar_bogie *b,
sonar_bogie **to_list)
{
- sonar_bogie *ob, *prev;
+ sonar_bogie *ob, *next;
if (!b) abort();
- for (prev = 0, ob = *to_list; ob; prev = ob, ob = ob->next)
+ for (ob = *to_list, next = ob ? ob->next : 0;
+ ob;
+ ob = next, next = ob ? ob->next : 0)
{
if (ob == b) abort(); /* this will end badly */
if (!strcmp (ob->name, b->name)) /* match! */