diff options
| author | joerg <joerg@NetBSD.org> | 2007-08-30 12:23:53 +0000 |
|---|---|---|
| committer | joerg <joerg@NetBSD.org> | 2007-08-30 12:23:53 +0000 |
| commit | 4deb593145a6d95f78a080aefb8cfc760bcddac9 (patch) | |
| tree | 798627c927bc10e7c4639b8f24a47fcdaf82600a /common/lib/libprop/prop_object_impl.h | |
| parent | ebcc6a8e1aa8ec2e8fd237a3d1512d620918c753 (diff) | |
Avoid using unbound amount of stack frames in prop_object_equal
by using a dynamic stack as well. Reorder arguments for the internalizer
as the iteration is always present and should go before possibly
NULL arguments.
Reviewed by mjf@ and adrianp@
Diffstat (limited to 'common/lib/libprop/prop_object_impl.h')
| -rw-r--r-- | common/lib/libprop/prop_object_impl.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/common/lib/libprop/prop_object_impl.h b/common/lib/libprop/prop_object_impl.h index 95fc9d51763..ed2318f34ff 100644 --- a/common/lib/libprop/prop_object_impl.h +++ b/common/lib/libprop/prop_object_impl.h @@ -1,4 +1,4 @@ -/* $NetBSD: prop_object_impl.h,v 1.17 2007/08/16 21:44:08 joerg Exp $ */ +/* $NetBSD: prop_object_impl.h,v 1.18 2007/08/30 12:23:54 joerg Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -111,6 +111,12 @@ enum { _PROP_OBJECT_FREE_FAILED }; +enum { + _PROP_OBJECT_EQUALS_FALSE, + _PROP_OBJECT_EQUALS_TRUE, + _PROP_OBJECT_EQUALS_RECURSE +}; + #define _PROP_EOF(c) ((c) == '\0') #define _PROP_ISSPACE(c) \ ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\r' || \ @@ -190,14 +196,24 @@ struct _prop_object_type { /* * func to free the child returned by pot_free with stack == NULL. * - * Must be implemented if pot_free can return non-0. + * Must be implemented if pot_free can return anything other than + * _PROP_OBJECT_FREE_DONE. */ void (*pot_emergency_free)(prop_object_t); /* func to externalize object */ bool (*pot_extern)(struct _prop_object_externalize_context *, void *); /* func to test quality */ - bool (*pot_equals)(void *, void *); + bool (*pot_equals)(prop_object_t, prop_object_t, + void **, void **, + prop_object_t *, prop_object_t *); + /* + * func to finish equality iteration. + * + * Must be implemented if pot_equals can return + * _PROP_OBJECT_EQUALS_RECURSE + */ + void (*pot_equals_finish)(prop_object_t, prop_object_t); }; struct _prop_object { |
