push
This commit is contained in:
36
srcs/srcs_asm/convert/conv_utils.c
Normal file
36
srcs/srcs_asm/convert/conv_utils.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* conv_utils.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mdchane <mdchane@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/07/11 12:17:14 by mdchane #+# #+# */
|
||||
/* Updated: 2019/07/11 13:28:14 by mdchane ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "asm.h"
|
||||
|
||||
t_label *get_label(t_token *tk, t_label *label)
|
||||
{
|
||||
char *name;
|
||||
|
||||
if (tk->type == INDIRECT_LABEL)
|
||||
name = ft_strdup(tk->contents + 1);
|
||||
else if (tk->type == DIRECT_LABEL)
|
||||
name = ft_strdup(tk->contents + 2);
|
||||
else
|
||||
return (NULL);
|
||||
while (label)
|
||||
{
|
||||
if (ft_strequ(label->contents, name))
|
||||
{
|
||||
ft_strdel(&name);
|
||||
return (label);
|
||||
}
|
||||
label = label->next;
|
||||
}
|
||||
ft_strdel(&name);
|
||||
return (NULL);
|
||||
}
|
Reference in New Issue
Block a user