Commit 74ec5c68 authored by David Rich's avatar David Rich Committed by Rob Latham
Browse files

Be consistent with return values (int vs. hg_return_t).

parent 4926f777
......@@ -10,7 +10,7 @@
// pass in NULL pointer to get default behavior
kv_context *kv_client_register(char *addr_str) {
int ret;
hg_return_t ret;
kv_context * context;
context = malloc(sizeof(kv_context));
......@@ -56,7 +56,7 @@ kv_context *kv_client_register(char *addr_str) {
int kv_open(kv_context *context, char * server, char *name,
kv_type keytype, kv_type valtype) {
int ret = HG_SUCCESS;
hg_return_t ret = HG_SUCCESS;
hg_handle_t handle;
open_in_t open_in;
open_out_t open_out;
......@@ -110,7 +110,7 @@ int kv_open(kv_context *context, char * server, char *name,
/* we gave types in the open call. Will need to maintain in 'context' the
* size. */
int kv_put(kv_context *context, void *key, void *value) {
int ret=0;
hg_return_t ret;
put_in_t put_in;
put_out_t put_out;
......@@ -125,7 +125,7 @@ int kv_put(kv_context *context, void *key, void *value) {
}
int kv_bulk_put(kv_context *context, void *key, void *data, hg_size_t data_size) {
int ret;
hg_return_t ret;
bulk_put_in_t bpin;
bulk_put_out_t bpout;
......@@ -146,7 +146,7 @@ int kv_bulk_put(kv_context *context, void *key, void *data, hg_size_t data_size)
int kv_get(kv_context *context, void *key, void *value)
{
int ret=0;
hg_return_t ret;
get_in_t get_in;
get_out_t get_out;
......@@ -162,7 +162,7 @@ int kv_get(kv_context *context, void *key, void *value)
int kv_bulk_get(kv_context *context, void *key, void *data, hg_size_t data_size)
{
int ret;
hg_return_t ret;
bulk_get_in_t bgin;
bulk_get_out_t bgout;
......@@ -183,7 +183,7 @@ int kv_bulk_get(kv_context *context, void *key, void *data, hg_size_t data_size)
int kv_close(kv_context *context)
{
int ret=0;
hg_return_t ret;
hg_handle_t handle;
put_in_t close_in;
put_out_t close_out;
......@@ -202,7 +202,7 @@ int kv_close(kv_context *context)
}
bench_result *kv_benchmark(kv_context *context, int count) {
int ret;
hg_return_t ret;
hg_handle_t handle;
bench_in_t bench_in;
bench_out_t bench_out;
......@@ -238,7 +238,7 @@ bench_result *kv_benchmark(kv_context *context, int count) {
}
int kv_client_deregister(kv_context *context) {
int ret;
hg_return_t ret;
margo_destroy(context->put_handle);
margo_destroy(context->get_handle);
......@@ -259,7 +259,7 @@ int kv_client_deregister(kv_context *context) {
}
int kv_client_shutdown_server(kv_context *context) {
int ret;
hg_return_t ret;
ret = margo_forward(context->shutdown_handle, NULL);
assert(ret == HG_SUCCESS);
......
......@@ -17,7 +17,6 @@ sdskeyval_get();
typedef int kv_id;
typedef enum {
KV_INT,
KV_UINT,
......@@ -59,7 +58,7 @@ MERCURY_GEN_PROC(put_in_t,
((int32_t)(key))\
((int32_t)(value)) )
MERCURY_GEN_PROC(put_out_t, ((int32_t)(ret)) )
MERCURY_GEN_PROC(put_out_t, ((hg_return_t)(ret)) )
DECLARE_MARGO_RPC_HANDLER(put_handler)
......@@ -67,7 +66,7 @@ MERCURY_GEN_PROC(get_in_t,
((int32_t)(key)) )
MERCURY_GEN_PROC(get_out_t,
((int32_t)(value)) ((int32_t)(ret)) )
((int32_t)(value)) ((hg_return_t)(ret)) )
DECLARE_MARGO_RPC_HANDLER(get_handler)
......@@ -76,7 +75,7 @@ MERCURY_GEN_PROC(open_in_t,
((int32_t) (keytype))\
((int32_t) (valtype)) )
MERCURY_GEN_PROC(open_out_t, ((int32_t)(ret)))
MERCURY_GEN_PROC(open_out_t, ((hg_return_t)(ret)))
DECLARE_MARGO_RPC_HANDLER(open_handler)
......@@ -84,7 +83,7 @@ MERCURY_GEN_PROC(close_in_t,
((int32_t)(x))\
((int32_t)(y)) )
MERCURY_GEN_PROC(close_out_t, ((int32_t)(ret)) )
MERCURY_GEN_PROC(close_out_t, ((hg_return_t)(ret)) )
DECLARE_MARGO_RPC_HANDLER(close_handler)
MERCURY_GEN_PROC(bench_in_t, ((int32_t)(count)) )
......@@ -110,7 +109,7 @@ MERCURY_GEN_PROC(bulk_put_in_t,
((uint64_t)(key)) \
((uint64_t)(size)) \
((hg_bulk_t)(bulk_handle)) )
MERCURY_GEN_PROC(bulk_put_out_t, ((int32_t)(ret)))
MERCURY_GEN_PROC(bulk_put_out_t, ((hg_return_t)(ret)))
DECLARE_MARGO_RPC_HANDLER(bulk_put_handler)
MERCURY_GEN_PROC(bulk_get_in_t,
......@@ -119,7 +118,7 @@ MERCURY_GEN_PROC(bulk_get_in_t,
((hg_bulk_t)(bulk_handle)) )
MERCURY_GEN_PROC(bulk_get_out_t,
((uint64_t)(size)) \
((int32_t)(ret)))
((hg_return_t)(ret)))
DECLARE_MARGO_RPC_HANDLER(bulk_get_handler)
kv_context *kv_client_register(char *addr_str=0);
......@@ -129,23 +128,22 @@ DECLARE_MARGO_RPC_HANDLER(shutdown_handler)
/* both the same: should probably move to common */
int kv_client_deregister(kv_context *context);
int kv_server_deregister(kv_context *context);
hg_return_t kv_client_deregister(kv_context *context);
hg_return_t kv_server_deregister(kv_context *context);
/* server-side routine */
int kv_server_wait_for_shutdown(kv_context *context);
hg_return_t kv_server_wait_for_shutdown(kv_context *context);
/* client-side routines wrapping up all the RPC stuff */
int kv_client_shutdown_server(kv_context *context);
int kv_open(kv_context *context, char *server, char *name,
hg_return_t kv_client_shutdown_server(kv_context *context);
hg_return_t kv_open(kv_context *context, char *server, char *name,
kv_type keytype, kv_type valtype);
int kv_put(kv_context *context, void *key, void *value);
int kv_bulk_put(kv_context *context, void *key, void *data, hg_size_t data_size);
int kv_get(kv_context *context, void *key, void *value);
hg_return_t kv_put(kv_context *context, void *key, void *value);
hg_return_t kv_bulk_put(kv_context *context, void *key, void *data, hg_size_t data_size);
hg_return_t kv_get(kv_context *context, void *key, void *value);
hg_return_t kv_bulk_get(kv_context *context, void *key, void *data, hg_size_t data_size);
hg_return_t kv_close(kv_context *context);
bench_result *kv_benchmark(kv_context *context, int count);
int kv_bulk_get(kv_context *context, void *key, void *data, hg_size_t data_size);
int kv_close(kv_context *context);
#if defined(__cplusplus)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment