cs_version() can accept NULL arguments. this is useful if you dont care about major/minor, but only want to get returned combined version

This commit is contained in:
Nguyen Anh Quynh 2013-12-22 14:16:28 +08:00
parent 9a197b35a1
commit 0877747bcd
3 changed files with 10 additions and 5 deletions

View File

@ -2,13 +2,13 @@
CAPSTONE_ARCHS =
# Comment the line below if you don't want to ARM support
CAPSTONE_ARCHS += arm
#CAPSTONE_ARCHS += arm
# Comment the line below if you don't want to ARM64 support
CAPSTONE_ARCHS += aarch64
#CAPSTONE_ARCHS += aarch64
# Comment the line below if you don't want to Mips support
CAPSTONE_ARCHS += mips
#CAPSTONE_ARCHS += mips
# Comment the line below if you don't want to X86 support
CAPSTONE_ARCHS += x86

6
cs.c
View File

@ -19,8 +19,10 @@ unsigned int all_arch = 0;
unsigned int cs_version(int *major, int *minor)
{
*major = CS_API_MAJOR;
*minor = CS_API_MINOR;
if (major != NULL && minor != NULL) {
*major = CS_API_MAJOR;
*minor = CS_API_MINOR;
}
return (CS_API_MAJOR << 8) + CS_API_MINOR;
}

View File

@ -141,6 +141,9 @@ typedef enum cs_err {
For example, second API version would return 1 in @major, and 1 in @minor
The return value would be 0x0101
NOTE: if you only care about returned value, but not major and minor values,
set both arguments to NULL.
*/
unsigned int cs_version(int *major, int *minor);