1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2025-01-10 17:32:05 +05:30

freadln.c: improve function I/O logic

This commit is contained in:
パチュリー・ノーレッジ 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" #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. * 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 { \ #define freadln_success_epilogue do { \
(*output)[length] = '\0'; \ (*output)[length] = '\0'; \
if (length_out == NULL) \ if (length_out != NULL) \
return length; \
else { \
*length_out = length; \ *length_out = length; \
return freadln_OK; \ return freadln_OK; \
} \
} while (0) } while (0)
ssize_t freadln(char** output, size_t* length_out); int freadln(char** output, size_t* length_out);
#endif /* _FREADLN_H */ #endif /* _FREADLN_H */