File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,4 +10,4 @@ cdef class UseDep:
1010 cdef int _hash
1111
1212 @staticmethod
13- cdef UseDep from_ptr(C.UseDep * )
13+ cdef UseDep from_ptr(C.UseDep * , UseDep inst = * )
Original file line number Diff line number Diff line change @@ -69,18 +69,13 @@ cdef class UseDep:
6969 if ptr is NULL :
7070 raise PkgcraftError
7171
72- self .kind = UseDepKind(ptr.kind)
73- self .flag = ptr.flag.decode()
74- if ptr.default_ is NULL :
75- self .default_ = None
76- else :
77- self .default_ = UseDepDefault(ptr.default_[0 ])
78- self .ptr = ptr
72+ UseDep.from_ptr(ptr, self )
7973
8074 @staticmethod
81- cdef UseDep from_ptr(C.UseDep * ptr):
75+ cdef UseDep from_ptr(C.UseDep * ptr, UseDep inst = None ):
8276 """ Create a UseDep from a pointer."""
83- inst = < UseDep> UseDep.__new__ (UseDep)
77+ if inst is None :
78+ inst = < UseDep> UseDep.__new__ (UseDep)
8479 inst.ptr = < C.UseDep * > ptr
8580 inst.kind = UseDepKind(ptr.kind)
8681 inst.flag = ptr.flag.decode()
You can’t perform that action at this time.
0 commit comments