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:
parent
8025dbfb61
commit
9d47a1d50b
@ -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.
|
||||
*
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user