shrinking the last few lines
This commit is contained in:
10
printf.c
10
printf.c
@@ -19,10 +19,8 @@ int _printf(const char *format, ...)
|
||||
identifiers = _contains(format, '%'); /* instances of %s, %c etc */
|
||||
BUFF_SIZE = _strlen(format) - identifiers;
|
||||
buffer = (char *) malloc(BUFF_SIZE); /* sized of the non % instances only*/
|
||||
if (!buffer)
|
||||
return (-1);
|
||||
|
||||
if (!format) /* No string. No laundry */
|
||||
if (!format && !buffer) /* No string. No laundry */
|
||||
return (0);
|
||||
|
||||
buff_idx = fmt_idx = 0; /*chain assignment*/
|
||||
@@ -44,11 +42,7 @@ int _printf(const char *format, ...)
|
||||
fmt_idx += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(buffer + buff_idx) = *(format + fmt_idx); /* filling up buffer */
|
||||
buff_idx++;
|
||||
fmt_idx++;
|
||||
}
|
||||
*(buffer + buff_idx++) = *(format + fmt_idx++); /* filling up buffer */
|
||||
}
|
||||
if (buffer)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user