Commit 1f56cb7d authored by Stefan Behnel's avatar Stefan Behnel

fix C compiler warning about missing struct initialisers, removed some dead code

parent b4ddca5e
...@@ -2828,7 +2828,7 @@ class CStructOrUnionType(CType): ...@@ -2828,7 +2828,7 @@ class CStructOrUnionType(CType):
if env.outer_scope is None: if env.outer_scope is None:
return False return False
if self._convert_to_py_code is False: return # tri-state-ish if self._convert_to_py_code is False: return None # tri-state-ish
if self._convert_to_py_code is None: if self._convert_to_py_code is None:
for member in self.scope.var_entries: for member in self.scope.var_entries:
...@@ -2846,7 +2846,7 @@ class CStructOrUnionType(CType): ...@@ -2846,7 +2846,7 @@ class CStructOrUnionType(CType):
if env.outer_scope is None: if env.outer_scope is None:
return False return False
if self._convert_from_py_code is False: return # tri-state-ish if self._convert_from_py_code is False: return None # tri-state-ish
if self._convert_from_py_code is None: if self._convert_from_py_code is None:
for member in self.scope.var_entries: for member in self.scope.var_entries:
...@@ -2856,20 +2856,10 @@ class CStructOrUnionType(CType): ...@@ -2856,20 +2856,10 @@ class CStructOrUnionType(CType):
self._convert_from_py_code = False self._convert_from_py_code = False
return False return False
forward_decl = (self.entry.visibility != 'extern')
# Avoid C compiler warnings
nesting_depth = 0
type = self
while type.is_struct_or_union:
type = type.scope.var_entries[0].type
nesting_depth += 1
context = dict( context = dict(
struct_type_decl = self.declaration_code(""), struct_type_decl = self.declaration_code(""),
var_entries = self.scope.var_entries, var_entries = self.scope.var_entries,
funcname = self.from_py_function, funcname = self.from_py_function,
init = '%s 0 %s' % ('{' * nesting_depth, '}' * nesting_depth)
) )
self._convert_from_py_code = TempitaUtilityCode.load( self._convert_from_py_code = TempitaUtilityCode.load(
"FromPyStructUtility", "TypeConversion.c", context=context) "FromPyStructUtility", "TypeConversion.c", context=context)
......
...@@ -4,7 +4,7 @@ static {{struct_type_decl}} {{funcname}}(PyObject *); ...@@ -4,7 +4,7 @@ static {{struct_type_decl}} {{funcname}}(PyObject *);
/////////////// FromPyStructUtility /////////////// /////////////// FromPyStructUtility ///////////////
static {{struct_type_decl}} {{funcname}}(PyObject * o) { static {{struct_type_decl}} {{funcname}}(PyObject * o) {
{{struct_type_decl}} result = {{init}}; {{struct_type_decl}} result;
PyObject *value = NULL; PyObject *value = NULL;
if (!PyMapping_Check(o)) { if (!PyMapping_Check(o)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment