Skip to content

Commit f98bde2

Browse files
author
ashuang
committed
emit_python: only emit new_parents in _get_hash_recursive if necessary
git-svn-id: https://lcm.googlecode.com/svn/trunk@519 989093bb-e83e-0410-a25a-9184cbcad8d0
1 parent 66b1bee commit f98bde2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lcmgen/emit_python.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,13 @@ emit_python_fingerprint (const lcmgen_t *lcm, FILE *f, lcm_struct_t *ls)
558558

559559
emit (1, "def _get_hash_recursive(parents):");
560560
emit (2, "if %s in parents: return 0", sn);
561-
emit (2, "newparents = parents + [%s]", sn);
561+
for (unsigned int m = 0; m < ls->members->len; m++) {
562+
lcm_member_t *lm = (lcm_member_t *) g_ptr_array_index(ls->members, m);
563+
if (! lcm_is_primitive_type (lm->type->lctypename)) {
564+
emit (2, "newparents = parents + [%s]", sn);
565+
break;
566+
}
567+
}
562568
emit_start (2, "tmphash = (0x%"PRIx64, ls->hash);
563569
for (unsigned int m = 0; m < ls->members->len; m++) {
564570
lcm_member_t *lm = (lcm_member_t *) g_ptr_array_index(ls->members, m);

0 commit comments

Comments
 (0)