Commit 00de161a authored by David Rich's avatar David Rich Committed by Rob Latham
Browse files

Pass char* as const. Use strcpy to copy value.

parent f838b291
......@@ -9,7 +9,7 @@
// pass in NULL pointer to get default behavior
kv_context *kv_client_register(char *addr_str) {
kv_context *kv_client_register(const char *addr_str) {
hg_return_t ret;
kv_context * context;
context = malloc(sizeof(kv_context));
......@@ -54,21 +54,21 @@ kv_context *kv_client_register(char *addr_str) {
return context;
hg_return_t kv_open(kv_context *context, char * server, char *name,
kv_type keytype, kv_type valtype) {
hg_return_t kv_open(kv_context *context, const char *server_addr, const char *db_name,
kv_type keytype, kv_type valtype) {
hg_return_t ret = HG_SUCCESS;
hg_handle_t handle;
open_in_t open_in;
open_out_t open_out;
ret = margo_addr_lookup(context->mid, server, &(context->svr_addr));
ret = margo_addr_lookup(context->mid, server_addr, &(context->svr_addr));
assert(ret == HG_SUCCESS);
ret = margo_create(context->mid, context->svr_addr,
context->open_id, &handle);
assert(ret == HG_SUCCESS); = name;
strcpy(, db_name);
ret = margo_forward(handle, &open_in);
assert(ret == HG_SUCCESS);
......@@ -121,12 +121,11 @@ MERCURY_GEN_PROC(bulk_get_out_t,
kv_context *kv_client_register(char *addr_str=0);
kv_context *kv_client_register(const char *addr_str=0);
kv_context * kv_server_register(margo_instance_id mid);
/* both the same: should probably move to common */
hg_return_t kv_client_deregister(kv_context *context);
hg_return_t kv_server_deregister(kv_context *context);
......@@ -136,7 +135,7 @@ hg_return_t kv_server_wait_for_shutdown(kv_context *context);
/* client-side routines wrapping up all the RPC stuff */
hg_return_t kv_client_signal_shutdown(kv_context *context);
hg_return_t kv_open(kv_context *context, char *server, char *name,
hg_return_t kv_open(kv_context *context, const char *server, const char *db_name,
kv_type keytype, kv_type valtype);
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, uint64_t *data_size);
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