From 7bb2aafbd616750120efba2e3c803111148f7ad5 Mon Sep 17 00:00:00 2001 From: LinlyBoi Date: Mon, 21 Aug 2023 13:22:40 +0300 Subject: [PATCH] DO NOT do that shit ever again I swear to fucking --- printf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/printf.c b/printf.c index 0cd45b6..c2dc18b 100644 --- a/printf.c +++ b/printf.c @@ -12,14 +12,15 @@ int _printf(const char *format, ...) { int buff_idx = 0; int fmt_idx = 0; - unsigned int identifiers = _contains(format, '%'); - unsigned int BUFF_SIZE = _strlen(format) - identifiers; + unsigned int identifiers, BUFF_SIZE; char *buffer, *next; char c; va_list args; + identifiers = _contains(format, '%'); va_start(args, format); buffer = malloc(BUFF_SIZE); + BUFF_SIZE = _strlen(format) - identifiers; if (!format) /* No string. No laundry */ return (0);