#ifndef _di_f_file_access_
f_status_t f_file_access(const f_string_static_t path, const int mode) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
if (access(path.string, mode) == -1) {
#ifndef _di_f_file_access_at_
f_status_t f_file_access_at(const int at_id, const f_string_static_t path, const int mode, const int flag) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
if (faccessat(at_id, path.string, mode, flag) == -1) {
#ifndef _di_f_file_clone_
f_status_t f_file_clone(const f_string_static_t source, const f_string_static_t destination, const f_number_unsigned_t size_block, const uint8_t flag) {
- if (!source.used || !destination.used) {
- return F_data_not;
- }
+ if (!source.used || !destination.used) return F_data_not;
struct stat source_stat;
#ifndef _di_f_file_copy_
f_status_t f_file_copy(const f_string_static_t source, const f_string_static_t destination, const f_mode_t mode, const f_number_unsigned_t size_block, const uint8_t flag) {
- if (!source.used || !destination.used) {
- return F_data_not;
- }
+ if (!source.used || !destination.used) return F_data_not;
f_status_t status = F_none;
struct stat source_stat;
#ifndef _di_f_file_create_
f_status_t f_file_create(const f_string_static_t path, const mode_t mode, const bool exclusive) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
return private_f_file_create(path, mode, exclusive);
}
#ifndef _di_f_file_create_at_
f_status_t f_file_create_at(const int at_id, const f_string_static_t path, const mode_t mode, const bool exclusive) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
return private_f_file_create_at(at_id, path, mode, exclusive);
}
#ifndef _di_f_file_create_device_
f_status_t f_file_create_device(const f_string_static_t path, const mode_t mode, const unsigned int major, const unsigned int minor) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
if (!macro_f_file_type_is_fifo(mode) && !macro_f_file_type_is_character(mode) && !macro_f_file_type_is_block(mode)) {
return F_status_set_error(F_supported_not);
#ifndef _di_f_file_create_device_at_
f_status_t f_file_create_device_at(const int at_id, const f_string_static_t path, const mode_t mode, const unsigned int major, const unsigned int minor) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
if (!macro_f_file_type_is_fifo(mode) && !macro_f_file_type_is_character(mode) && !macro_f_file_type_is_block(mode)) {
return F_status_set_error(F_supported_not);
#ifndef _di_f_file_create_fifo_
f_status_t f_file_create_fifo(const f_string_static_t path, const mode_t mode) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
return private_f_file_create_fifo(path, mode);
}
#ifndef _di_f_file_create_fifo_at_
f_status_t f_file_create_fifo_at(const int at_id, const f_string_static_t path, const mode_t mode) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
return private_f_file_create_fifo_at(at_id, path, mode);
}
#ifndef _di_f_file_create_node_
f_status_t f_file_create_node(const f_string_static_t path, const mode_t mode, const dev_t device) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
if (!macro_f_file_type_is_fifo(mode) && !macro_f_file_type_is_character(mode) && !macro_f_file_type_is_block(mode)) {
return F_status_set_error(F_supported_not);
#ifndef _di_f_file_create_node_at_
f_status_t f_file_create_node_at(const int at_id, const f_string_static_t path, const mode_t mode, const dev_t device) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
if (!macro_f_file_type_is_fifo(mode) && !macro_f_file_type_is_character(mode) && !macro_f_file_type_is_block(mode)) {
return F_status_set_error(F_supported_not);
file->id = fileno(file->stream);
- if (file->id == -1) {
- return F_status_set_error(F_stream_not);
- }
+ if (file->id == -1) return F_status_set_error(F_stream_not);
return F_none;
}
#ifndef _di_f_file_exists_
f_status_t f_file_exists(const f_string_static_t path, const bool dereference) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
const f_status_t status = private_f_file_stat(path, dereference, &stat_file);
if (F_status_is_error(status)) {
- if (F_status_set_fine(status) == F_file_found_not) {
- return F_false;
- }
+ if (F_status_set_fine(status) == F_file_found_not) return F_false;
return status;
}
#ifndef _di_f_file_exists_at_
f_status_t f_file_exists_at(const int at_id, const f_string_static_t path, const int flag) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
const f_status_t status = private_f_file_stat_at(at_id, path, flag, &stat_file);
if (F_status_is_error(status)) {
- if (F_status_set_fine(status) == F_file_found_not) {
- return F_false;
- }
+ if (F_status_set_fine(status) == F_file_found_not) return F_false;
return status;
}
if (!group) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
#ifndef _di_f_file_is_
f_status_t f_file_is(const f_string_static_t path, const int type, const bool dereference) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
if (F_status_is_error(status)) return status;
}
- if (macro_f_file_type_get(stat_file.st_mode) == type) {
- return F_true;
- }
+ if (macro_f_file_type_get(stat_file.st_mode) == type) return F_true;
return F_false;
}
#ifndef _di_f_file_is_at_
f_status_t f_file_is_at(const int at_id, const f_string_static_t path, const int type, const int flag) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
return F_status_set_error(F_file_stat);
}
- if (macro_f_file_type_get(stat_file.st_mode) == type) {
- return F_true;
- }
+ if (macro_f_file_type_get(stat_file.st_mode) == type) return F_true;
return F_false;
}
#ifndef _di_f_file_link_
f_status_t f_file_link(const f_string_static_t target, const f_string_static_t point) {
- if (!target.used || !point.used) {
- return F_data_not;
- }
+ if (!target.used || !point.used) return F_data_not;
return private_f_file_link(target, point);
}
#ifndef _di_f_file_link_at_
f_status_t f_file_link_at(const int at_id, const f_string_static_t target, const f_string_static_t point) {
- if (!target.used || !point.used) {
- return F_data_not;
- }
+ if (!target.used || !point.used) return F_data_not;
return private_f_file_link_at(at_id, target, point);
}
#ifndef _di_f_file_link_hard_
f_status_t f_file_link_hard(const f_string_static_t target, const f_string_static_t point) {
- if (!target.used || !point.used) {
- return F_data_not;
- }
+ if (!target.used || !point.used) return F_data_not;
if (link(target.string, point.string) < 0) {
if (errno == EACCES) return F_status_set_error(F_access_denied);
#ifndef _di_f_file_link_hard_at_
f_status_t f_file_link_hard_at(const int at_id_target, const int at_id_point, const f_string_static_t target, const f_string_static_t point, const int flag) {
- if (!target.used || !point.used) {
- return F_data_not;
- }
+ if (!target.used || !point.used) return F_data_not;
if (linkat(at_id_target, target.string, at_id_point, point.string, flag) < 0) {
if (errno == EACCES) return F_status_set_error(F_access_denied);
if (!target) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
if (!target) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
if (!replace) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!code.used) {
- return F_data_not;
- }
+ if (!code.used) return F_data_not;
uint8_t syntax = 0;
uint8_t replace_result = 0;
if (code.string[0] == f_string_ascii_plus_s.string[0] || code.string[0] == f_string_ascii_minus_s.string[0] || code.string[0] == f_string_ascii_equal_s.string[0]) {
- if (code.used < 2) {
- return F_status_set_error(F_syntax);
- }
+ if (code.used < 2) return F_status_set_error(F_syntax);
if (code.string[1] == f_string_ascii_r_s.string[0] || code.string[1] == f_string_ascii_w_s.string[0] || code.string[1] == f_string_ascii_x_s.string[0] || code.string[1] == f_string_ascii_X_s.string[0] || code.string[1] == f_string_ascii_s_s.string[0] ||code.string[1] == f_string_ascii_t_s.string[0]) {
syntax = 1;
}
else if (code.string[0] == f_string_ascii_u_s.string[0] || code.string[0] == f_string_ascii_g_s.string[0] || code.string[0] == f_string_ascii_o_s.string[0] || code.string[0] == f_string_ascii_a_s.string[0]) {
- if (code.used < 2) {
- return F_status_set_error(F_syntax);
- }
+ if (code.used < 2) return F_status_set_error(F_syntax);
syntax = 1;
}
}
} // for
- if (incomplete) {
- return F_status_set_error(F_syntax);
- }
+ if (incomplete) return F_status_set_error(F_syntax);
}
else if (syntax == 2) {
f_array_length_t j = 0;
// Do not tolerate overly large numbers.
- if (code.used - i > 4) {
- return F_status_set_error(F_syntax);
- }
+ if (code.used - i > 4) return F_status_set_error(F_syntax);
for (; i + j < code.used; ++j) {
if (!mode) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
if (!mode) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
#ifndef _di_f_file_mode_set_
f_status_t f_file_mode_set(const f_string_static_t path, const mode_t mode) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
return private_f_file_mode_set(path, mode);
}
#ifndef _di_f_file_mode_set_at_
f_status_t f_file_mode_set_at(const int at_id, const f_string_static_t path, const mode_t mode) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
return private_f_file_mode_set_at(at_id, path, mode);
}
if (!name_base) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
// POSIX basename() modifies the path, so protect it (and add a terminating NULL).
char path_argument[path.used + 1];
if (!name_directory) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
// POSIX dirname() modifies the path, so protect it (and add a terminating NULL).
char path_argument[path.used + 1];
if (!file) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
return private_f_file_open(path, mode, file);
}
if (!file) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
return private_f_file_open_at(at_id, path, mode, file);
}
if (!owner) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
if (!buffer) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (file.id == -1) {
- return F_status_set_error(F_file_closed);
- }
+ if (file.id == -1) return F_status_set_error(F_file_closed);
f_status_t status = F_none;
ssize_t size_read = 0;
if (!buffer) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (file.id == -1) {
- return F_status_set_error(F_file_closed);
- }
+ if (file.id == -1) return F_status_set_error(F_file_closed);
ssize_t size_read = 0;
return F_status_set_error(F_failure);
}
- if (size_read) {
- return F_none;
- }
+ if (size_read) return F_none;
return F_none_eof;
}
if (!buffer) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (file.id == -1) {
- return F_status_set_error(F_file_closed);
- }
+ if (file.id == -1) return F_status_set_error(F_file_closed);
- if (!total) {
- return F_data_not;
- }
+ if (!total) return F_data_not;
f_array_length_t buffer_size = file.size_read;
f_array_length_t buffer_count = 0;
buffer->used += size_read;
- if (!size_read) {
- return F_none_eof;
- }
+ if (!size_read) return F_none_eof;
buffer_count += size_read;
#ifndef _di_f_file_remove_
f_status_t f_file_remove(const f_string_static_t path) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
if (unlink(path.string) < 0) {
if (errno == EACCES) return F_status_set_error(F_access_denied);
#ifndef _di_f_file_remove_at_
f_status_t f_file_remove_at(const int at_id, const f_string_static_t path, const int flag) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
if (unlinkat(at_id, path.string, flag) < 0) {
if (errno == EACCES) return F_status_set_error(F_access_denied);
#ifndef _di_f_file_rename_
f_status_t f_file_rename(const f_string_static_t source, const f_string_static_t destination) {
- if (!source.used || !destination.used) {
- return F_data_not;
- }
+ if (!source.used || !destination.used) return F_data_not;
if (rename(source.string, destination.string) < 0) {
if (errno == EACCES) return F_status_set_error(F_access_denied);
#ifndef _di_f_file_rename_at_
f_status_t f_file_rename_at(const int at_id, const int to_id, const f_string_static_t source, const f_string_static_t destination, const unsigned int flag) {
- if (!source.used || !destination.used) {
- return F_data_not;
- }
+ if (!source.used || !destination.used) return F_data_not;
#ifdef _f_file_rename_use_renameat2_
if (renameat2(at_id, source.string, to_id, destination.string, flag) < 0) {
#ifndef _di_f_file_role_change_
f_status_t f_file_role_change(const f_string_static_t path, const uid_t uid, const gid_t gid, const bool dereference) {
- if ((uid == -1 && gid == -1) || !path.used) {
- return F_data_not;
- }
+ if ((uid == -1 && gid == -1) || !path.used) return F_data_not;
return private_f_file_role_change(path, uid, gid, dereference);
}
#ifndef _di_f_file_role_change_at_
f_status_t f_file_role_change_at(const int at_id, const f_string_static_t path, const uid_t uid, const gid_t gid, const int flag) {
- if ((uid == -1 && gid == -1) || !path.used) {
- return F_data_not;
- }
+ if ((uid == -1 && gid == -1) || !path.used) return F_data_not;
return private_f_file_role_change_at(at_id, path, uid, gid, flag);
}
if (!size) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
if (!size) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
if (!size) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (id == -1) {
- return F_status_set_error(F_file_closed);
- }
+ if (id == -1) return F_status_set_error(F_file_closed);
struct stat stat_file;
if (!stat_file) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
return private_f_file_stat(path, dereference, stat_file);
}
if (!stat_file) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
return private_f_file_stat_at(at_id, path, flag, stat_file);
}
if (!file) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
if (mode.used) {
file->stream = fopen(path.string, mode.string);
file->id = fileno(file->stream);
- if (file->id == -1) {
- return F_status_set_error(F_file_descriptor);
- }
+ if (file->id == -1) return F_status_set_error(F_file_descriptor);
return F_none;
}
if (!file) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (file->id == -1) {
- return F_status_set_error(F_file_descriptor);
- }
+ if (file->id == -1) return F_status_set_error(F_file_descriptor);
if (mode.used) {
file->stream = fdopen(file->id, private_f_file_stream_open_mode_determine(file->flag));
if (!buffer) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!file.stream) {
- return F_status_set_error(F_file_closed);
- }
+ if (!file.stream) return F_status_set_error(F_file_closed);
flockfile(file.stream);
if (!buffer) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!file.stream) {
- return F_status_set_error(F_file_closed);
- }
+ if (!file.stream) return F_status_set_error(F_file_closed);
flockfile(file.stream);
if (!buffer) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!file.stream) {
- return F_status_set_error(F_file_closed);
- }
-
- if (!total) {
- return F_none_stop;
- }
+ if (!file.stream) return F_status_set_error(F_file_closed);
+ if (!total) return F_none_stop;
flockfile(file.stream);
if (!file) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used && !mode.used) {
- return F_data_not;
- }
+ if (!path.used && !mode.used) return F_data_not;
FILE *result = 0;
file->stream = result;
file->id = fileno(file->stream);
- if (file->id == -1) {
- return F_status_set_error(F_file_descriptor);
- }
+ if (file->id == -1) return F_status_set_error(F_file_descriptor);
return F_none;
}
if (!file.size_write) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!file.stream) {
- return F_status_set_error(F_file_closed);
- }
+ if (!file.stream) return F_status_set_error(F_file_closed);
if (!buffer.used) {
if (written) {
if (written) {
status = private_f_file_stream_write_until(file, buffer, buffer.used, written);
- if (status == F_none && *written == buffer.used) {
- return F_none_eos;
- }
+ if (status == F_none && *written == buffer.used) return F_none_eos;
}
else {
f_array_length_t written_local = 0;
status = private_f_file_stream_write_until(file, buffer, buffer.used, &written_local);
- if (status == F_none && written_local == buffer.used) {
- return F_none_eos;
- }
+ if (status == F_none && written_local == buffer.used) return F_none_eos;
}
return status;
if (!file.size_write) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!file.stream) {
- return F_status_set_error(F_file_closed);
- }
+ if (!file.stream) return F_status_set_error(F_file_closed);
if (!buffer.used) {
if (written) {
status = private_f_file_stream_write_until(file, buffer, write_max, written);
if (status == F_none) {
- if (*written == buffer.used) {
- return F_none_eos;
- }
-
- if (*written == write_max) {
- return F_none_stop;
- }
+ if (*written == buffer.used) return F_none_eos;
+ if (*written == write_max) return F_none_stop;
}
}
else {
status = private_f_file_stream_write_until(file, buffer, write_max, &written_local);
if (status == F_none) {
- if (written_local == buffer.used) {
- return F_none_eos;
- }
-
- if (written_local == write_max) {
- return F_none_stop;
- }
+ if (written_local == buffer.used) return F_none_eos;
+ if (written_local == write_max) return F_none_stop;
}
}
if (!file.size_write) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!file.stream) {
- return F_status_set_error(F_file_closed);
- }
+ if (!file.stream) return F_status_set_error(F_file_closed);
if (!buffer.used || !total) {
if (written) {
status = private_f_file_stream_write_until(file, buffer, write_max, written);
if (status == F_none) {
- if (*written == buffer.used) {
- return F_none_eos;
- }
-
- if (*written == write_max) {
- return F_none_stop;
- }
+ if (*written == buffer.used) return F_none_eos;
+ if (*written == write_max) return F_none_stop;
}
}
else {
status = private_f_file_stream_write_until(file, buffer, buffer.used, &written_local);
if (status == F_none) {
- if (written_local == buffer.used) {
- return F_none_eos;
- }
-
- if (written_local == write_max) {
- return F_none_stop;
- }
+ if (written_local == buffer.used) return F_none_eos;
+ if (written_local == write_max) return F_none_stop;
}
}
if (!file.size_write) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!file.stream) {
- return F_status_set_error(F_file_closed);
- }
+ if (!file.stream) return F_status_set_error(F_file_closed);
if (!buffer.used || range.start > range.stop || range.start >= buffer.used) {
if (written) {
status = private_f_file_stream_write_until(file, buffer_adjusted, write_max, written);
if (status == F_none) {
- if (range.start + *written == buffer.used) {
- return F_none_stop;
- }
-
- if (range.start + *written == total) {
- return F_none_eos;
- }
+ if (range.start + *written == buffer.used) return F_none_stop;
+ if (range.start + *written == total) return F_none_eos;
}
}
else {
status = private_f_file_stream_write_until(file, buffer_adjusted, write_max, &written_local);
if (status == F_none) {
- if (range.start + written_local == buffer.used) {
- return F_none_eos;
- }
-
- if (range.start + written_local == total) {
- return F_none_stop;
- }
+ if (range.start + written_local == buffer.used) return F_none_eos;
+ if (range.start + written_local == total) return F_none_stop;
}
}
#ifndef _di_f_file_touch_
f_status_t f_file_touch(const f_string_static_t path, const mode_t mode, const bool dereference) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
f_status_t status = F_none;
struct stat stat_file;
status = private_f_file_stat(path, dereference, &stat_file);
- if (F_status_set_fine(status) == F_file_found_not) {
- return private_f_file_create(path, mode, dereference);
- }
-
- if (F_status_is_error(status)) {
- return status;
- }
+ if (F_status_set_fine(status) == F_file_found_not) return private_f_file_create(path, mode, dereference);
+ if (F_status_is_error(status)) return status;
if (utimensat(F_file_at_current_working_d, path.string, 0, dereference ? 0 : F_file_at_symlink_follow_no_d) < 0) {
if (errno == EACCES) return F_status_set_error(F_access_denied);
#ifndef _di_f_file_touch_at_
f_status_t f_file_touch_at(const int at_id, const f_string_static_t path, const mode_t mode, const int flag) {
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
f_status_t status = F_none;
struct stat stat_file;
status = private_f_file_stat_at(at_id, path, flag, &stat_file);
- if (F_status_set_fine(status) == F_file_found_not) {
- return private_f_file_create_at(at_id, path, mode, F_false);
- }
-
+ if (F_status_set_fine(status) == F_file_found_not) return private_f_file_create_at(at_id, path, mode, F_false);
if (F_status_is_error(status)) return status;
if (utimensat(at_id, path.string, 0, flag) < 0) {
if (!type) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
if (!type) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!path.used) {
- return F_data_not;
- }
+ if (!path.used) return F_data_not;
struct stat stat_file;
if (!file.size_write) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (file.id == -1) {
- return F_status_set_error(F_file_closed);
- }
+ if (file.id == -1) return F_status_set_error(F_file_closed);
if (!buffer.used) {
if (written) *written = 0;
if (written) {
status = private_f_file_write_until(file, buffer, buffer.used, written);
- if (status == F_none && *written == buffer.used) {
- return F_none_eos;
- }
+ if (status == F_none && *written == buffer.used) return F_none_eos;
}
else {
f_array_length_t written_local = 0;
status = private_f_file_write_until(file, buffer, buffer.used, &written_local);
- if (status == F_none && written_local == buffer.used) {
- return F_none_eos;
- }
+ if (status == F_none && written_local == buffer.used) return F_none_eos;
}
return status;
if (!file.size_write) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (file.id == -1) {
- return F_status_set_error(F_file_closed);
- }
+ if (file.id == -1) return F_status_set_error(F_file_closed);
if (!buffer.used) {
if (written) *written = 0;
status = private_f_file_write_until(file, buffer, write_max, written);
if (status == F_none) {
- if (*written == buffer.used) {
- return F_none_eos;
- }
-
- if (*written == write_max) {
- return F_none_stop;
- }
+ if (*written == buffer.used) return F_none_eos;
+ if (*written == write_max) return F_none_stop;
}
}
else {
status = private_f_file_write_until(file, buffer, write_max, &written_local);
if (status == F_none) {
- if (written_local == buffer.used) {
- return F_none_eos;
- }
-
- if (written_local == write_max) {
- return F_none_stop;
- }
+ if (written_local == buffer.used) return F_none_eos;
+ if (written_local == write_max) return F_none_stop;
}
}
if (!file.size_write) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (file.id == -1) {
- return F_status_set_error(F_file_closed);
- }
+ if (file.id == -1) return F_status_set_error(F_file_closed);
if (!buffer.used || !total) {
if (written) *written = 0;
status = private_f_file_write_until(file, buffer, write_max, written);
if (status == F_none) {
- if (*written == buffer.used) {
- return F_none_eos;
- }
-
- if (*written == write_max) {
- return F_none_stop;
- }
+ if (*written == buffer.used) return F_none_eos;
+ if (*written == write_max) return F_none_stop;
}
}
else {
status = private_f_file_write_until(file, buffer, buffer.used, &written_local);
if (status == F_none) {
- if (written_local == buffer.used) {
- return F_none_eos;
- }
-
- if (written_local == write_max) {
- return F_none_stop;
- }
+ if (written_local == buffer.used) return F_none_eos;
+ if (written_local == write_max) return F_none_stop;
}
}
if (!file.size_write) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (file.id == -1) {
- return F_status_set_error(F_file_closed);
- }
+ if (file.id == -1) return F_status_set_error(F_file_closed);
if (!buffer.used || range.start > range.stop || range.start >= buffer.used) {
if (written) {
status = private_f_file_write_until(file, buffer_adjusted, write_max, written);
if (status == F_none) {
- if (range.start + *written == buffer.used) {
- return F_none_stop;
- }
-
- if (range.start + *written == total) {
- return F_none_eos;
- }
+ if (range.start + *written == buffer.used) return F_none_stop;
+ if (range.start + *written == total) return F_none_eos;
}
}
else {
status = private_f_file_write_until(file, buffer_adjusted, write_max, &written_local);
if (status == F_none) {
- if (range.start + written_local == buffer.used) {
- return F_none_eos;
- }
-
- if (range.start + written_local == total) {
- return F_none_stop;
- }
+ if (range.start + written_local == buffer.used) return F_none_eos;
+ if (range.start + written_local == total) return F_none_stop;
}
}