mirror of
https://github.com/wassname/ray.git
synced 2026-07-04 10:12:22 +08:00
Use sizeof(field) instead of sizeof(type) and other fixes. (#47)
* Use sizeof(field) instead of sizeof(type) and other fixes. * Fix formatting. * Bug fix. * Zero-initialize structs. There are many more instances of these that I haven't changed yet. * Bug fix. * Revert from atexit to signaling to fix valgrind tests. * Address Philipp's comments.
This commit is contained in:
committed by
Philipp Moritz
parent
d77b685a90
commit
c8c3983195
@@ -33,7 +33,7 @@ static int PyObjectID_init(PyObjectID *self, PyObject *args, PyObject *kwds) {
|
||||
"ObjectID: object id string needs to have length 20");
|
||||
return -1;
|
||||
}
|
||||
memcpy(&self->object_id.id[0], data, sizeof(object_id));
|
||||
memcpy(&self->object_id.id[0], data, sizeof(self->object_id.id));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ PyObject *PyObjectID_make(object_id object_id) {
|
||||
static PyObject *PyObjectID_id(PyObject *self) {
|
||||
PyObjectID *s = (PyObjectID *) self;
|
||||
return PyString_FromStringAndSize((char *) &s->object_id.id[0],
|
||||
sizeof(object_id));
|
||||
sizeof(s->object_id.id));
|
||||
}
|
||||
|
||||
static PyObject *PyObjectID_richcompare(PyObjectID *self,
|
||||
|
||||
Reference in New Issue
Block a user