mirror of
https://gitlab.com/80486DX2-66/gists
synced 2025-01-10 08:27:48 +05:30
reverse-ramdisk.c: reorder operations to improve speed
This commit is contained in:
parent
52aa23d585
commit
df2d4f3dd9
@ -81,12 +81,14 @@ int tf_alloc(size_t n, size_t type_size) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Assign the ID and file path
|
||||
// Assign the ID, file path, file handler
|
||||
temp_file->ID = num_temp_files;
|
||||
temp_file->file_path = strdup(file_path);
|
||||
temp_file->file = file;
|
||||
|
||||
// Increase the number of temp files
|
||||
// Add the temp file to the array
|
||||
temp_files[num_temp_files] = *temp_file;
|
||||
|
||||
num_temp_files++;
|
||||
|
||||
// Allocate/reallocate memory for the temp_files structure
|
||||
@ -100,9 +102,6 @@ int tf_alloc(size_t n, size_t type_size) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Add the temp file to the array
|
||||
temp_files[num_temp_files - 1] = *temp_file;
|
||||
|
||||
return temp_file->ID;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user