src/labels.c
/*
**	Fairly generic linked list adder. Nothing to see here.
*/
Fairly generic linked list adder. Nothing to see here.
Fairly generic linked list adder . Nothing to see here .
void	add_label(char *label, unsigned int cursor)
{
	t_label	*end;
	if (!g_labels)
	{
		g_labels = (t_label *)ft_memalloc(sizeof(t_label));
		g_labels->label = ft_strdup(label);
		g_labels->cursor = cursor;
		g_labels->next = 0;
	}
	else
	{
		end = g_labels;
		while (end->next)
			end = end->next;
		end->next = (t_label *)ft_memalloc(sizeof(t_label));
		end->next->label = ft_strdup(label);
		end->next->cursor = cursor;
		end->next->next = 0;
	}
}
void add_label ( char * label , unsigned int cursor ) { t_label * end ; if ( ! g_labels ) { g_labels = ( t_label * ) ft_memalloc ( sizeof ( t_label ) ) ; g_labels -> label = ft_strdup ( label ) ; g_labels -> cursor = cursor ; g_labels -> next = 0 ; } else { end = g_labels ; while ( end -> next ) end = end -> next ; end -> next = ( t_label * ) ft_memalloc ( sizeof ( t_label ) ) ; end -> next -> label = ft_strdup ( label ) ; end -> next -> cursor = cursor ; end -> next -> next = 0 ; } }
Fairly generic linked list adder.
Fairly generic linked list adder .