X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fc_client.py;h=08d6ec40e8946a2bd2f9f22123d88e666c2e5652;hb=28a71c6567d08272dc9c1c2b32f0529f11f62b9e;hp=26826e42fc400407377a102d69ce2f9794e5ccfa;hpb=5e8a7ade2dc8aeeeb8013785ca3f24c6057ae443;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/c_client.py b/src/c_client.py index 26826e4..08d6ec4 100644 --- a/src/c_client.py +++ b/src/c_client.py @@ -399,8 +399,9 @@ def _c_type_setup(self, name, postfix): if self.need_sizeof: if self.c_sizeof_name not in finished_sizeof: - finished_sizeof.append(self.c_sizeof_name) - _c_serialize('sizeof', self) + if not module.namespace.is_ext or self.name[:2] == module.namespace.prefix: + finished_sizeof.append(self.c_sizeof_name) + _c_serialize('sizeof', self) # _c_type_setup() def _c_helper_absolute_name(prefix, field=None): @@ -1133,8 +1134,7 @@ def _c_serialize(context, self): return elif self.var_followed_by_fixed_fields: # special case: call _unserialize() - _c(' %s *_aux = NULL;', self.c_type) - _c(' return %s(%s, &_aux);', self.c_unserialize_name, reduce(lambda x,y: "%s, %s" % (x, y), param_names)) + _c(' return %s(%s, NULL);', self.c_unserialize_name, reduce(lambda x,y: "%s, %s" % (x, y), param_names)) _c('}') return else: @@ -1179,6 +1179,12 @@ def _c_serialize(context, self): # allocate memory and copy everything into a continuous memory area # note: this is not necessary in case of unpack if context in ('serialize', 'unserialize'): + # unserialize: check for sizeof-only invocation + if 'unserialize' == context: + _c('') + _c(' if (NULL == _aux)') + _c(' return xcb_buffer_len;') + _c('') _c(' if (NULL == %s) {', aux_ptr) _c(' /* allocate memory */')