inline decl, memset fix(??)

This commit is contained in:
2023-08-22 17:50:03 +03:00
parent 05df0a9cc4
commit ae280081e0
2 changed files with 10 additions and 11 deletions

View File

@@ -4,19 +4,19 @@
* _memset - sets values of bytes to specific value * _memset - sets values of bytes to specific value
* *
* @adr: head address * @adr: head address
* @n: number of bytes * @bval: number of bytes
* *
* Return: pointer to place * Return: pointer to place
*/ */
char* _memset(char *str, int bval) char *_memset(char *adr, int bval)
{ {
int i; int i;
for (i = 0; i < _strlen(str); i++) for (i = 0; i < _strlen(adr); i++)
{ {
*(str + i) = bval; *(adr + i) = bval;
} }
return (str); return (adr);
} }

View File

@@ -26,9 +26,8 @@ int _printf(const char *format, ...)
if (!format) /* No string. No laundry */ if (!format) /* No string. No laundry */
return (0); return (0);
buff_idx = 0; /* was there a way to squish these together? */ buff_idx = fmt_idx = 0; /*chain assignment*/
fmt_idx = 0; printed = 0; /*this alone due to diff type*/
printed = 0;
while (*(format + fmt_idx)) while (*(format + fmt_idx))
{ {
if ((*(format + fmt_idx) == '%') && (*(format + fmt_idx + 1))) if ((*(format + fmt_idx) == '%') && (*(format + fmt_idx + 1)))
@@ -63,9 +62,9 @@ int _printf(const char *format, ...)
fmt_idx++; fmt_idx++;
} }
} }
if (buffer) /*final buffer check*/ if (buffer)
{ {
printed += _puts(buffer); _puts(buffer);
free(buffer); free(buffer);
} }
return (printed); return (printed);