I noticed odd differences between the 0.6.x and the 0.7.x in terms of memory usage.
I discovered this to be due to a bug where the f_string_t is being used when the type should be instead f_char_t.
This is likely a bug introduced in some past refactor.
f_status_t private_f_string_append(const f_string_t source, const f_number_unsigned_t length, f_string_dynamic_t * const destination) {
{
- const f_status_t status = f_memory_array_increase_by(length + 1, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
+ const f_status_t status = f_memory_array_increase_by(length + 1, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
if (F_status_is_error(status)) return status;
}
if (size + 1 > F_string_t_size_d) return F_status_set_error(F_string_too_large);
- status = f_memory_array_increase_by(size + 1, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
+ status = f_memory_array_increase_by(size + 1, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
if (F_status_is_error(status)) return status;
f_number_unsigned_t first = 0;
if (destination->used + length + 1 > F_string_t_size_d) return F_status_set_error(F_string_too_large);
{
- const f_status_t status = f_memory_array_increase_by(length + 1, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
+ const f_status_t status = f_memory_array_increase_by(length + 1, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
if (F_status_is_error(status)) return status;
}
if (i > first) {
size = i - first;
- status = f_memory_array_increase_by(size + 1, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
+ status = f_memory_array_increase_by(size + 1, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
if (F_status_is_error(status)) return status;
memmove(destination->string + offset + size, destination->string + offset, sizeof(f_char_t) * (destination->used - offset));
if (i > first) {
size = i - first;
- status = f_memory_array_increase_by(size + 1, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
+ status = f_memory_array_increase_by(size + 1, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
if (F_status_is_error(status)) return status;
memmove(destination->string + offset + size, destination->string + offset, sizeof(f_char_t) * (destination->used - offset));
if (!structure) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- return f_memory_array_adjust(length, sizeof(f_string_t), (void **) &structure->string, &structure->used, &structure->size);
+ return f_memory_array_adjust(length, sizeof(f_char_t), (void **) &structure->string, &structure->used, &structure->size);
}
#endif // _di_f_string_dynamic_adjust_
if (!structure) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- return f_memory_array_decimate_by(amount, sizeof(f_string_t), (void **) &structure->string, &structure->used, &structure->size);
+ return f_memory_array_decimate_by(amount, sizeof(f_char_t), (void **) &structure->string, &structure->used, &structure->size);
}
#endif // _di_f_string_dynamic_decimate_by_
if (!structure) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- return f_memory_array_decrease_by(amount, sizeof(f_string_t), (void **) &structure->string, &structure->used, &structure->size);
+ return f_memory_array_decrease_by(amount, sizeof(f_char_t), (void **) &structure->string, &structure->used, &structure->size);
}
#endif // _di_f_string_dynamic_decrease_by_
if (!structure) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- return f_memory_array_increase(step, sizeof(f_string_t), (void **) &structure->string, &structure->used, &structure->size);
+ return f_memory_array_increase(step, sizeof(f_char_t), (void **) &structure->string, &structure->used, &structure->size);
}
#endif // _di_f_string_dynamic_increase_
if (!structure) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- return f_memory_array_increase_by(amount, sizeof(f_string_t), (void **) &structure->string, &structure->used, &structure->size);
+ return f_memory_array_increase_by(amount, sizeof(f_char_t), (void **) &structure->string, &structure->used, &structure->size);
}
#endif // _di_f_string_dynamic_increase_by_
if (!structure) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- return f_memory_array_resize(length, sizeof(f_string_t), (void **) &structure->string, &structure->used, &structure->size);
+ return f_memory_array_resize(length, sizeof(f_char_t), (void **) &structure->string, &structure->used, &structure->size);
}
#endif // _di_f_string_dynamic_resize_
if (destination->used == F_string_t_size_d) return F_status_set_error(F_string_too_large);
{
- const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
+ const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
if (F_status_is_error(status)) return status;
}
if (destination->used == F_string_t_size_d) return F_status_set_error(F_string_too_large);
{
- const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
+ const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
if (F_status_is_error(status)) return status;
}
for (f_number_unsigned_t i = length; i < structure->size; ++i) {
- status = f_memory_array_adjust(0, sizeof(f_string_t), (void **) &structure->array[i].string, &structure->array[i].used, &structure->array[i].size);
+ status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &structure->array[i].string, &structure->array[i].used, &structure->array[i].size);
if (F_status_is_error(status)) return status;
} // for
for (f_number_unsigned_t i = length; i < structure->size; ++i) {
- status = f_memory_array_adjust(0, sizeof(f_string_t), (void **) &structure->array[i].name.string, &structure->array[i].name.used, &structure->array[i].name.size);
+ status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &structure->array[i].name.string, &structure->array[i].name.used, &structure->array[i].name.size);
if (F_status_is_error(status)) return status;
status = private_f_string_dynamics_adjust(0, &structure->array[i].value);
for (f_number_unsigned_t i = length; i < structure->size; ++i) {
- status = f_memory_array_resize(0, sizeof(f_string_t), (void **) &structure->array[i].name.string, &structure->array[i].name.used, &structure->array[i].name.size);
+ status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &structure->array[i].name.string, &structure->array[i].name.used, &structure->array[i].name.size);
if (F_status_is_error(status)) return status;
status = private_f_string_dynamics_resize(0, &structure->array[i].value);
for (f_number_unsigned_t i = length; i < structure->size; ++i) {
- status = f_memory_array_adjust(0, sizeof(f_string_t), (void **) &structure->array[i].name.string, &structure->array[i].name.used, &structure->array[i].name.size);
+ status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &structure->array[i].name.string, &structure->array[i].name.used, &structure->array[i].name.size);
if (F_status_is_error(status)) return status;
- status = f_memory_array_adjust(0, sizeof(f_string_t), (void **) &structure->array[i].value.string, &structure->array[i].value.used, &structure->array[i].value.size);
+ status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &structure->array[i].value.string, &structure->array[i].value.used, &structure->array[i].value.size);
if (F_status_is_error(status)) return status;
} // for
for (f_number_unsigned_t i = length; i < structure->size; ++i) {
- status = f_memory_array_resize(0, sizeof(f_string_t), (void **) &structure->array[i].name.string, &structure->array[i].name.used, &structure->array[i].name.size);
+ status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &structure->array[i].name.string, &structure->array[i].name.used, &structure->array[i].name.size);
if (F_status_is_error(status)) return status;
- status = f_memory_array_resize(0, sizeof(f_string_t), (void **) &structure->array[i].value.string, &structure->array[i].value.used, &structure->array[i].value.size);
+ status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &structure->array[i].value.string, &structure->array[i].value.used, &structure->array[i].value.size);
if (F_status_is_error(status)) return status;
} // for
// There is no reason to include "." and ".." in the directory listing.
if (!strncmp(name_directory.string, "..", 3) || !strncmp(name_directory.string, ".", 2)) {
- f_memory_resize(1, 0, sizeof(f_string_t), (void **) & entity[i]);
+ f_memory_resize(1, 0, sizeof(f_char_t), (void **) & entity[i]);
continue;
}
void private_fll_execute_path_arguments_fixate(const f_string_static_t program_path, const f_string_statics_t arguments, const f_string_t last_slash, const bool fixated_is, f_string_static_t program_name, f_string_t fixed_arguments[]) {
memset(program_name.string, 0, sizeof(f_char_t) * (program_name.used + 1));
- memset(fixed_arguments, 0, sizeof(f_string_t) * (arguments.used + 2));
+ memset(fixed_arguments, 0, sizeof(f_char_t) * (arguments.used + 2));
memcpy(program_name.string, last_slash ? last_slash + 1 : program_path.string, sizeof(f_char_t) * program_name.used);