Re-implemented asm_guess_format()
This commit is contained in:
parent
fb4de7ccdf
commit
65f26c5a51
17
src/asm.c
17
src/asm.c
@ -243,6 +243,23 @@ int asm_guess_arch(Asm * a)
|
||||
}
|
||||
|
||||
|
||||
/* asm_guess_format */
|
||||
int asm_guess_format(Asm * a)
|
||||
{
|
||||
int ret = -1;
|
||||
AsmCode * code;
|
||||
char const * format;
|
||||
|
||||
if((code = asmcode_new(a->arch, a->format)) == NULL)
|
||||
return -1;
|
||||
if((format = asmcode_get_format(code)) != NULL
|
||||
&& asm_set_format(a, format) == 0)
|
||||
ret = 0;
|
||||
asmcode_delete(code);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* asm_instruction */
|
||||
int asm_instruction(Asm * a, char const * name, unsigned int operands_cnt, ...)
|
||||
{
|
||||
|
@ -257,7 +257,9 @@ char const * asmcode_get_filename(AsmCode * code)
|
||||
/* asmcode_get_format */
|
||||
char const * asmcode_get_format(AsmCode * code)
|
||||
{
|
||||
return format_get_name(code->format);
|
||||
if(code->format != NULL)
|
||||
return format_get_name(code->format);
|
||||
return arch_get_format(code->arch);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user