Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove useless constructors
The Reference, Branch, ConfigIter and Walker types were allowed to be created by the
user, but no constructor was set, and the default values are either
meaningless (in the case of Reference/Branch) or would cause a segfault
as soon as one tried to use them (ConfigIter and Walker).

Remove the constructor from these types, as they don't serve a purpose
and can only be used by mistake.
  • Loading branch information
carlosmn committed Jan 28, 2014
commit 94e841bfb2eda428477bb47f7b6025539c4e3ceb
8 changes: 4 additions & 4 deletions src/pygit2.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ moduleinit(PyObject* m)
/*
* Log
*/
INIT_TYPE(WalkerType, NULL, PyType_GenericNew)
INIT_TYPE(WalkerType, NULL, NULL)
ADD_TYPE(m, Walker);
ADD_CONSTANT_INT(m, GIT_SORT_NONE)
ADD_CONSTANT_INT(m, GIT_SORT_TOPOLOGICAL)
Expand All @@ -329,7 +329,7 @@ moduleinit(PyObject* m)
/*
* References
*/
INIT_TYPE(ReferenceType, NULL, PyType_GenericNew)
INIT_TYPE(ReferenceType, NULL, NULL)
INIT_TYPE(RefLogEntryType, NULL, NULL)
INIT_TYPE(RefLogIterType, NULL, NULL)
INIT_TYPE(NoteType, NULL, NULL)
Expand All @@ -345,7 +345,7 @@ moduleinit(PyObject* m)
/*
* Branches
*/
INIT_TYPE(BranchType, &ReferenceType, PyType_GenericNew);
INIT_TYPE(BranchType, &ReferenceType, NULL);
ADD_TYPE(m, Branch)
ADD_CONSTANT_INT(m, GIT_BRANCH_LOCAL)
ADD_CONSTANT_INT(m, GIT_BRANCH_REMOTE)
Expand Down Expand Up @@ -425,7 +425,7 @@ moduleinit(PyObject* m)

/* Config */
INIT_TYPE(ConfigType, NULL, PyType_GenericNew)
INIT_TYPE(ConfigIterType, NULL, PyType_GenericNew)
INIT_TYPE(ConfigIterType, NULL, NULL)
ADD_TYPE(m, Config)
ADD_TYPE(m, ConfigIter)

Expand Down