aboutsummaryrefslogtreecommitdiff
path: root/src/io/ft_printf/internals/parse.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-18 16:39:52 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-18 16:39:52 +0200
commitdd0c485ac4975b7dd6d2e230213be1da50d0a065 (patch)
tree5fbd967f8b95c72fbb696bb089c2cc349d28b61f /src/io/ft_printf/internals/parse.c
parent3c3f1115f6e9a9b914e2dcbd796501ca7ce85342 (diff)
downloadlibft-dd0c485ac4975b7dd6d2e230213be1da50d0a065.tar.gz
libft-dd0c485ac4975b7dd6d2e230213be1da50d0a065.tar.bz2
libft-dd0c485ac4975b7dd6d2e230213be1da50d0a065.zip
Removing unnecessary stuffmalloc
Diffstat (limited to 'src/io/ft_printf/internals/parse.c')
-rw-r--r--src/io/ft_printf/internals/parse.c61
1 files changed, 0 insertions, 61 deletions
diff --git a/src/io/ft_printf/internals/parse.c b/src/io/ft_printf/internals/parse.c
deleted file mode 100644
index 33928a0..0000000
--- a/src/io/ft_printf/internals/parse.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ************************************************************************** */
-/* */
-/* ::: :::::::: */
-/* parse.c :+: :+: :+: */
-/* +:+ +:+ +:+ */
-/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
-/* +#+#+#+#+#+ +#+ */
-/* Created: 2019/10/29 00:11:33 by cacharle #+# #+# */
-/* Updated: 2019/11/13 08:13:02 by cacharle ### ########.fr */
-/* */
-/* ************************************************************************** */
-
-#include "ft_vasprintf.h"
-
-int parse(const char *format, t_flist **flist)
-{
- t_flist *tmp;
- t_pformat *parsed;
-
- *flist = NULL;
- while (*format)
- {
- format++;
- if (format[-1] != '%')
- continue;
- if ((parsed = parse_reduced(format)) == NULL)
- return ((int)list_destroy(flist));
- if ((tmp = list_new(parsed)) == NULL)
- return ((int)list_destroy(flist));
- list_push_front(flist, tmp);
- format += (*flist)->content->fmt_len;
- }
- *flist = list_reverse(*flist);
- return (1);
-}
-
-t_pformat *parse_reduced(const char *fmt)
-{
- t_pformat *pformat;
- const char *start;
-
- if ((pformat = (t_pformat*)malloc(sizeof(t_pformat))) == NULL)
- return (NULL);
- pformat->precision = -1;
- pformat->width = -1;
- pformat->flags = 0;
- start = fmt;
- fmt = extract_flags(pformat, fmt);
- fmt = extract_width(pformat, fmt);
- fmt = extract_precision(pformat, fmt);
- fmt = extract_length_modifier(pformat, fmt);
- pformat->fmt_len = fmt - start + 1;
- if (*fmt == '\0' || ft_strchr(SPECIFIERS_STR, *fmt) == NULL)
- {
- pformat->fmt_len--;
- pformat->specifier = '_';
- }
- else
- pformat->specifier = *ft_strchr(SPECIFIERS_STR, *fmt);
- return (pformat);
-}