1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2024-11-12 22:45:54 +05:30

freadln.c: improve function I/O logic

This commit is contained in:
Intel A80486DX2-66 2024-03-10 14:14:02 +03:00
parent 8025dbfb61
commit 9d47a1d50b
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B
2 changed files with 4 additions and 7 deletions

View File

@ -16,7 +16,7 @@
#include "freadln.h"
ssize_t freadln(char** output, size_t* length_out) {
int freadln(char** output, size_t* length_out) {
/*
* The length of STDIN line is counted without any terminating characters.
*

View File

@ -21,14 +21,11 @@ enum freadln_status {
#define freadln_success_epilogue do { \
(*output)[length] = '\0'; \
if (length_out == NULL) \
return length; \
else { \
if (length_out != NULL) \
*length_out = length; \
return freadln_OK; \
} \
return freadln_OK; \
} while (0)
ssize_t freadln(char** output, size_t* length_out);
int freadln(char** output, size_t* length_out);
#endif /* _FREADLN_H */