Make Ray code C++ compatible#321
Conversation
c43d756 to
90c938b
Compare
|
Test FAILed. |
|
Test FAILed. |
|
Test FAILed. |
|
Test FAILed. |
|
Test FAILed. |
|
Test FAILed. |
|
Some compiler warnings |
|
Test FAILed. |
|
Test FAILed. |
| void *user_context) { | ||
| CHECK(db_handle != NULL); | ||
| ObjectTableSubscribeData *sub_data = malloc(sizeof(ObjectTableSubscribeData)); | ||
| ObjectTableSubscribeData *sub_data = (ObjectTableSubscribeData *) malloc(sizeof(ObjectTableSubscribeData)); |
There was a problem hiding this comment.
I would put the entire right hand side on the second line .
| object_info_done_callback done_callback, | ||
| void *user_context) { | ||
| ObjectInfoSubscribeData *sub_data = malloc(sizeof(ObjectInfoSubscribeData)); | ||
| ObjectInfoSubscribeData *sub_data = (ObjectInfoSubscribeData *) malloc(sizeof(ObjectInfoSubscribeData)); |
There was a problem hiding this comment.
same here, might be easier to have the cast and the malloc on the same (second) line.
| /* Including hiredis here is necessary on Windows for typedefs used in ae.h. */ | ||
| #include "hiredis/hiredis.h" | ||
| #include "hiredis/adapters/ae.h" | ||
| } |
There was a problem hiding this comment.
do we still need the extern C here?
There was a problem hiding this comment.
Yes, we do not convert hiredis to C++
|
|
||
| int wait_timeout_handler(event_loop *loop, timer_id id, void *context) { | ||
| wait_request *wait_req = context; | ||
| wait_request *wait_req = (wait_request *) context; |
There was a problem hiding this comment.
seems we're still far from being consistent with the new naming convention, but this sounds like a separate PR to me.
| ObjectInfo notification = {.obj_id = object_id, .is_deletion = true}; | ||
| ObjectInfo notification; | ||
| notification.obj_id = object_id; | ||
| notification.is_deletion = true; |
There was a problem hiding this comment.
c++ struct init : ObjectInfo notification = {object_id, true};
but ok as is as well.
There was a problem hiding this comment.
One problem with that kind of initialization (which I think I've run into in the past), is that if you change the struct definition it may still compile, but the values might correspond to different fields in the struct now.
| local_buf.object_id = oid; | ||
| local_buf.data_size = data_size; | ||
| local_buf.metadata_size = metadata_size; | ||
| local_buf.data = (uint8_t *) malloc(data_size); |
There was a problem hiding this comment.
might be best to use cpp struct initialization style here (with so many fields).
There was a problem hiding this comment.
Looks like there may be some uninitialized fields here. This could be the cause of the Travis valgrind failure.
|
Test FAILed. |
|
Merged build finished. Test FAILed. |
|
Test FAILed. |
No description provided.