[Loader] Code formatting

This commit is contained in:
Maschell 2018-02-04 16:42:59 +01:00
parent 76271cee58
commit 5ed70a368e
2 changed files with 5 additions and 13 deletions

View File

@ -75,11 +75,8 @@ void printModuleInformation(module_information_t* module_information){
}else{ }else{
DEBUG_FUNCTION_LINE("metadata is null\n"); DEBUG_FUNCTION_LINE("metadata is null\n");
} }
} }
bool Module_CheckFile(const char *path) { bool Module_CheckFile(const char *path) {
const char *extension; const char *extension;
@ -263,13 +260,13 @@ module_information_t* Module_LoadMetaDataFromElf(const char *path, Elf *elf) {
} else { } else {
metadata->size += shdr->sh_size; metadata->size += shdr->sh_size;
/* add alignment padding to size */ /* add alignment padding to size */
if (shdr->sh_addralign > 3) if (shdr->sh_addralign > 3){
/* roundup to multiple of sh_addralign */ /* roundup to multiple of sh_addralign */
metadata->size += metadata->size += (-metadata->size & (shdr->sh_addralign - 1));
(-metadata->size & (shdr->sh_addralign - 1)); }else{
else
/* roundup to multiple of 4 */ /* roundup to multiple of 4 */
metadata->size += (-metadata->size & 3); metadata->size += (-metadata->size & 3);
}
} }
} }
} }
@ -308,9 +305,7 @@ static module_information_t *Module_ModuleInformationRead(const char *path, Elf
entries_count = 0; entries_count = 0;
for (scn = elf_nextscn(elf, NULL); for (scn = elf_nextscn(elf, NULL); scn != NULL; scn = elf_nextscn(elf, scn)) {
scn != NULL;
scn = elf_nextscn(elf, scn)) {
Elf32_Shdr *shdr; Elf32_Shdr *shdr;
const char *name; const char *name;

View File

@ -25,7 +25,6 @@ typedef struct {
size_t entries_count; size_t entries_count;
} module_metadata_t; } module_metadata_t;
typedef struct { typedef struct {
const char *name; const char *name;
void *address; void *address;
@ -43,6 +42,4 @@ bool Module_CheckFile(const char *path);
void printModuleInformation(module_information_t* module_information); void printModuleInformation(module_information_t* module_information);
module_information_t* Module_LoadModuleInformation(const char *path); module_information_t* Module_LoadModuleInformation(const char *path);
#endif #endif