object_utils.c
 1  /* ************************************************************************** */
 2  /*                                                                            */
 3  /*                                                        :::      ::::::::   */
 4  /*   object_utils.c                                     :+:      :+:    :+:   */
 5  /*                                                    +:+ +:+         +:+     */
 6  /*   By: gychoi <gychoi@student.42seoul.kr>         +#+  +:+       +#+        */
 7  /*                                                +#+#+#+#+#+   +#+           */
 8  /*   Created: 2023/05/27 21:53:29 by gychoi            #+#    #+#             */
 9  /*   Updated: 2023/05/27 22:02:33 by gychoi           ###   ########.fr       */
10  /*                                                                            */
11  /* ************************************************************************** */
12  
13  #include "object_utils.h"
14  
15  void	oadd(t_object **list, t_object *new)
16  {
17  	t_object	*cur;
18  
19  	if (*list == 0)
20  	{
21  		*list = new;
22  		return ;
23  	}
24  	cur = *list;
25  	while (cur->next)
26  		cur = cur->next;
27  	cur->next = new;
28  }
29  
30  t_object	*olast(t_object *list)
31  {
32  	if (list == 0)
33  		return (0);
34  	while (list->next)
35  		list = list->next;
36  	return (list);
37  }