The NULL character should not be printed for "safely" print functions.
The private inline functions should be made static.
* @return
* The appropriate status.
*/
-inline f_status_t private_inline_f_print_to_error() {
+static inline f_status_t private_inline_f_print_to_error() {
if (errno == EAGAIN || errno == EWOULDBLOCK) return F_status_set_error(F_block);
if (errno == EBADF) return F_status_set_error(F_file_descriptor);
if (errno == EDESTADDRREQ) return F_status_set_error(F_socket_not);
safe = private_f_print_character_safely_get(string[i]);
}
else {
- safe = 0;
+ if (total) {
+ if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ return F_status_set_error(F_output);
+ }
+
+ total = 0;
+ }
+
+ start = ++i;
+ continue;
}
width = macro_f_utf_character_t_width(string[i]);
safe = private_f_print_character_safely_get(string[i]);
}
else {
- safe = 0;
+ if (total) {
+ if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ return F_status_set_error(F_output);
+ }
+
+ total = 0;
+ }
+
+ start = ++i;
+ continue;
}
width = macro_f_utf_character_t_width(string[i]);
safe = private_f_print_character_safely_get(string[i]);
}
else {
- safe = 0;
+ if (total) {
+ if (fwrite_unlocked(string + start, 1, total, output) == -1) {
+ return F_status_set_error(F_output);
+ }
+
+ total = 0;
+ }
+
+ start = ++i;
+ continue;
}
width = macro_f_utf_character_t_width(string[i]);
* @return
* The appropriate status.
*/
-inline f_status_t private_inline_f_print_to_error() {
+static inline f_status_t private_inline_f_print_to_error() {
if (errno == EAGAIN || errno == EWOULDBLOCK) return F_status_set_error(F_block);
if (errno == EBADF) return F_status_set_error(F_file_descriptor);
if (errno == EDESTADDRREQ) return F_status_set_error(F_socket_not);
safe = private_f_print_character_safely_get(string[i]);
}
else {
- safe = 0;
+ if (total) {
+ if (write(id, string + start, total) == -1) {
+ return private_inline_f_print_to_error();
+ }
+
+ total = 0;
+ }
+
+ start = ++i;
+ continue;
}
if (safe) {
safe = private_f_print_character_safely_get(string[i]);
}
else {
- safe = 0;
+ if (total) {
+ if (write(id, string + start, total) == -1) {
+ return private_inline_f_print_to_error();
+ }
+
+ total = 0;
+ }
+
+ start = ++i;
+ continue;
}
if (safe) {
safe = private_f_print_character_safely_get(string[i]);
}
else {
- safe = 0;
+ if (total) {
+ if (write(id, string + start, total) == -1) {
+ return private_inline_f_print_to_error();
+ }
+
+ total = 0;
+ }
+
+ start = ++i;
+ continue;
}
if (safe) {