mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-18 22:54:25 +01:00
elements: Move from a global is_elements to a global chainparams
We now have a pointer to chainparams, that fails valgrind if we do anything chain-specific before setting it. Suggested-by: Rusty Russell <@rustyrussell>
This commit is contained in:
committed by
Rusty Russell
parent
378745391d
commit
ef7a63d8f8
@@ -115,9 +115,12 @@ class Field(object):
|
||||
return ', const {} *{}'.format(type_name, self.name)
|
||||
|
||||
def arg_desc_from(self):
|
||||
type_name = self.type_obj.type_name()
|
||||
if self.type_obj.is_const_ptr_ptr_type():
|
||||
return ', const {} **{}'.format(type_name, self.name)
|
||||
|
||||
if self.len_field_of:
|
||||
return ''
|
||||
type_name = self.type_obj.type_name()
|
||||
if self.is_array():
|
||||
return ', {} {}[{}]'.format(type_name, self.name, self.count)
|
||||
ptrs = '*'
|
||||
@@ -244,6 +247,12 @@ class Type(FieldSet):
|
||||
# FIXME: omits 'pad'
|
||||
}
|
||||
|
||||
# Types that are const pointer-to-pointers, such as chainparams, i.e.,
|
||||
# they set a reference to some const entry.
|
||||
const_ptr_ptr_types = [
|
||||
'chainparams'
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def true_type(type_name, field_name=None, outer_name=None):
|
||||
""" Returns 'true' type of a given type and a flag if
|
||||
@@ -308,6 +317,9 @@ class Type(FieldSet):
|
||||
def is_subtype(self):
|
||||
return bool(self.fields)
|
||||
|
||||
def is_const_ptr_ptr_type(self):
|
||||
return self.name in self.const_ptr_ptr_types
|
||||
|
||||
def is_truncated(self):
|
||||
return self.name in self.truncated_typedefs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user