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:
Robert Nishihara
2016-11-19 12:19:49 -08:00
committed by Philipp Moritz
parent d77b685a90
commit c8c3983195
16 changed files with 106 additions and 100 deletions
+2 -2
View File
@@ -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,