auto manager the region buffer & remove the unused vars
This commit is contained in:
parent
4ff67f168c
commit
0179edc3a8
|
|
@ -15,7 +15,7 @@ struct searcher_test_entry {
|
||||||
xdb_content_t *c_buffer;
|
xdb_content_t *c_buffer;
|
||||||
|
|
||||||
// xdb region buffer
|
// xdb region buffer
|
||||||
char region_buffer[256];
|
// char region_buffer[256];
|
||||||
xdb_region_buffer_t region;
|
xdb_region_buffer_t region;
|
||||||
};
|
};
|
||||||
typedef struct searcher_test_entry searcher_test_t;
|
typedef struct searcher_test_entry searcher_test_t;
|
||||||
|
|
@ -95,7 +95,8 @@ int init_searcher_test(searcher_test_t *test, char *db_path, char *cache_policy)
|
||||||
}
|
}
|
||||||
|
|
||||||
// init the region buffer
|
// init the region buffer
|
||||||
err = xdb_region_buffer_init(&test->region, test->region_buffer, sizeof(test->region_buffer));
|
// err = xdb_region_buffer_init(&test->region, test->region_buffer, sizeof(test->region_buffer));
|
||||||
|
err = xdb_region_buffer_init(&test->region, NULL, 0);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
printf("failed to init the region buffer with err=%d\n", err);
|
printf("failed to init the region buffer with err=%d\n", err);
|
||||||
errcode = 7;
|
errcode = 7;
|
||||||
|
|
@ -162,8 +163,7 @@ void test_search(int argc, char *argv[]) {
|
||||||
|
|
||||||
// for search
|
// for search
|
||||||
long s_time, c_time;
|
long s_time, c_time;
|
||||||
unsigned int ip;
|
char line[512] = {'\0'};
|
||||||
char line[512] = {'\0'}, region[512] = {'\0'};
|
|
||||||
|
|
||||||
// ip parse
|
// ip parse
|
||||||
xdb_version_t *version;
|
xdb_version_t *version;
|
||||||
|
|
@ -370,7 +370,7 @@ void test_bench(int argc, char *argv[]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xdb_ip_sub_compare(sip_bytes, s_version->bytes, eip_bytes, 0) > 0) {
|
if (xdb_ip_sub_compare(sip_bytes, s_version->bytes, (string_ip_t *) eip_bytes, 0) > 0) {
|
||||||
printf("start ip(%s) should not be greater than end ip(%s)\n", sip_str, eip_str);
|
printf("start ip(%s) should not be greater than end ip(%s)\n", sip_str, eip_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ void test_ip_compare() {
|
||||||
bytes_ip_t sip_bytes[16] = {'\0'};
|
bytes_ip_t sip_bytes[16] = {'\0'};
|
||||||
bytes_ip_t eip_bytes[16] = {'\0'};
|
bytes_ip_t eip_bytes[16] = {'\0'};
|
||||||
xdb_version_t *s_version, *e_version;
|
xdb_version_t *s_version, *e_version;
|
||||||
int bytes, errcode;
|
int errcode;
|
||||||
|
|
||||||
// init the sock env (for windows)
|
// init the sock env (for windows)
|
||||||
if ((errcode = xdb_init_winsock()) != 0) {
|
if ((errcode = xdb_init_winsock()) != 0) {
|
||||||
|
|
@ -155,7 +155,7 @@ void test_ip_compare() {
|
||||||
printf(
|
printf(
|
||||||
"ip_sub_compare(%s, %s): %d\n",
|
"ip_sub_compare(%s, %s): %d\n",
|
||||||
pair_ptr->sip, pair_ptr->eip,
|
pair_ptr->sip, pair_ptr->eip,
|
||||||
xdb_ip_sub_compare(sip_bytes, s_version->bytes, eip_bytes, 0)
|
xdb_ip_sub_compare(sip_bytes, s_version->bytes, (string_ip_t *) eip_bytes, 0)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue