Skip to content

Commit

Permalink
use memset to initialize with zero
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfr committed Aug 1, 2016
1 parent bf3d9f2 commit d62963d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/generate_datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def datatype_ptr(self):
return "&" + self.outname.upper() + "[" + self.outname.upper() + "_" + self.name.upper() + "]"

def functions_c(self):
funcs = "static UA_INLINE void\nUA_%s_init(UA_%s *p) {\n#ifdef __cplusplus\n *p = {0};\n#else\n *p = (UA_%s){0};\n#endif\n}\n\n" % (self.name, self.name, self.name)
funcs = "static UA_INLINE void\nUA_%s_init(UA_%s *p) {\n memset(p, 0, sizeof(UA_%s));\n}\n\n" % (self.name, self.name, self.name)
funcs += "static UA_INLINE UA_%s *\nUA_%s_new(void) {\n return (UA_%s*)UA_new(%s);\n}\n\n" % (self.name, self.name, self.name, self.datatype_ptr())
if self.fixed_size == "true":
funcs += "static UA_INLINE UA_StatusCode\nUA_%s_copy(const UA_%s *src, UA_%s *dst) {\n *dst = *src;\n return UA_STATUSCODE_GOOD;\n}\n\n" % (self.name, self.name, self.name)
Expand Down

0 comments on commit d62963d

Please sign in to comment.