Skip to content

Commit

Permalink
cs_version() can accept NULL arguments. this is useful if you dont ca…
Browse files Browse the repository at this point in the history
…re about major/minor, but only want to get returned combined version
  • Loading branch information
aquynh committed Dec 22, 2013
1 parent 9a197b3 commit 0877747
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 4 additions & 2 deletions cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions include/capstone.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 0877747

Please sign in to comment.