From b90cb993edef0eb703bfe0fa7de46419a158d97c Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Sat, 28 Dec 2013 13:59:09 +0800 Subject: [PATCH] API cs_version_ex(): since we already broke API compatibility, we are not afraid to break cs_version() too. this replaces cs_version() with cs_version_ex() --- cs.c | 8 +------- include/capstone.h | 22 +++++++--------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/cs.c b/cs.c index 3d671bec..58de52f4 100644 --- a/cs.c +++ b/cs.c @@ -19,13 +19,7 @@ cs_err (*arch_option[MAX_ARCH]) (cs_struct*, cs_opt_type, size_t value); unsigned int all_arch = 0; -void cs_version(int *major, int *minor) -{ - *major = CS_API_MAJOR; - *minor = CS_API_MINOR; -} - -unsigned int cs_version_ex(int *major, int *minor) +unsigned int cs_version(int *major, int *minor) { if (major != NULL && minor != NULL) { *major = CS_API_MAJOR; diff --git a/include/capstone.h b/include/capstone.h index 00281d3e..9d1be4e8 100644 --- a/include/capstone.h +++ b/include/capstone.h @@ -17,7 +17,7 @@ extern "C" { #define CS_API_MINOR 1 // Macro to create combined version which can be compared to -// result of cs_version_ex() API. +// result of cs_version() API. #define CS_MAKE_VERSION(major, minor) ((major << 8) + minor) // Handle using with all API @@ -141,32 +141,24 @@ typedef enum cs_err { CS_ERR_DETAIL, // Information is unavailable because detail option is OFF } cs_err; -/* - Retrieve API version in major and minor numbers. - - @major: major number of API version - @minor: minor number of API version - - For example, first API version would return 1 in @major, and 0 in @minor -*/ -void cs_version(int *major, int *minor); - - /* Return combined API version & major and minor version numbers. @major: major number of API version @minor: minor number of API version - @return hexical number encoding both major & minor versions, which is comparisonable. + @return hexical number as (major << 8 | minor), which encodes both + major & minor versions. + NOTE: This returned value can be compared with version number made + with macro CS_MAKE_VERSION 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. + set both @major & @minor arguments to NULL. */ -unsigned int cs_version_ex(int *major, int *minor); +unsigned int cs_version(int *major, int *minor); /*