diff mbox

[ovs-dev,v2,05/21] expr: Refine handling of error parameter to expr_annotate().

Message ID 1470672872-19450-6-git-send-email-blp@ovn.org
State Superseded
Headers show

Commit Message

Ben Pfaff Aug. 8, 2016, 4:14 p.m. UTC
In most cases expr_annotate() set '*errorp' to NULL if it was successful,
but there was one case where it did not.  This corrects that and refines
the comment to better explain the intended behavior.

This didn't affect any existing users because all of them passed in a
pointer that was already NULL.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 ovn/lib/expr.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/ovn/lib/expr.c b/ovn/lib/expr.c
index 050e694..a28684b 100644
--- a/ovn/lib/expr.c
+++ b/ovn/lib/expr.c
@@ -1473,6 +1473,7 @@  expr_annotate_cmp(struct expr *expr, const struct shash *symtab,
         }
     }
 
+    *errorp = NULL;
     ovs_list_remove(&an.node);
     return prereqs ? expr_combine(EXPR_T_AND, expr, prereqs) : expr;
 
@@ -1532,8 +1533,10 @@  expr_annotate__(struct expr *expr, const struct shash *symtab,
  *
  * In each case, annotation occurs recursively as necessary.
  *
- * On failure, returns NULL and sets '*errorp' to an explanatory error
- * message, which the caller must free. */
+ * If successful, returns the annotated expression and sets '*errorp' to NULL.
+ * On failure, returns NULL and sets '*errorp' to an explanatory error message,
+ * which the caller must free.  In either case, the caller transfers ownership
+ * of 'expr' and receives ownership of the returned expression, if any. */
 struct expr *
 expr_annotate(struct expr *expr, const struct shash *symtab, char **errorp)
 {