From: Peter Johnson Date: Mon, 22 Apr 2002 06:17:11 +0000 (-0000) Subject: Splint cleanups: expr_copy_* don't take a NULL, so they can't return NULL. X-Git-Tag: v0.2.0~240 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6f0bff9727c239784c84741d2b1b6ab9ed31f46;p=yasm Splint cleanups: expr_copy_* don't take a NULL, so they can't return NULL. svn path=/trunk/yasm/; revision=599 --- diff --git a/libyasm/expr-int.h b/libyasm/expr-int.h index 6c37fa20..1f0ed2df 100644 --- a/libyasm/expr-int.h +++ b/libyasm/expr-int.h @@ -86,7 +86,7 @@ int expr_traverse_leaves_in(expr *e, /*@null@*/ void *d, void expr_order_terms(expr *e); /* Copy entire expression EXCEPT for index "except" at *top level only*. */ -/*@null@*/ expr *expr_copy_except(const expr *e, int except); +expr *expr_copy_except(const expr *e, int except); int expr_contains(expr *e, ExprType t); diff --git a/libyasm/expr.c b/libyasm/expr.c index 4da07dc9..5273c241 100644 --- a/libyasm/expr.c +++ b/libyasm/expr.c @@ -42,7 +42,7 @@ static int expr_traverse_nodes_post(/*@null@*/ expr *e, /*@null@*/ void *d, /* allocate a new expression node, with children as defined. * If it's a unary operator, put the element in left and set right=NULL. */ -/*@-usedef@*/ +/*@-compmempass@*/ expr * expr_new(ExprOp op, ExprItem *left, ExprItem *right) { @@ -95,7 +95,7 @@ expr_new(ExprOp op, ExprItem *left, ExprItem *right) return ptr; } -/*@=usedef@*/ +/*@=compmempass@*/ /* helpers */ ExprItem * @@ -627,9 +627,6 @@ expr_copy_except(const expr *e, int except) expr *n; int i; - if (!e) - return 0; - n = xmalloc(sizeof(expr)+sizeof(ExprItem)*(e->numterms<2?0:e->numterms-2)); n->op = e->op; diff --git a/libyasm/expr.h b/libyasm/expr.h index d76a5d4f..3403edb2 100644 --- a/libyasm/expr.h +++ b/libyasm/expr.h @@ -41,7 +41,7 @@ typedef struct ExprItem ExprItem; expr_new (EXPR_IDENT, (r), (ExprItem *)NULL) /* allocates and makes an exact duplicate of e */ -/*@null@*/ expr *expr_copy(const expr *e); +expr *expr_copy(const expr *e); void expr_delete(/*@only@*/ /*@null@*/ expr *e); diff --git a/src/expr-int.h b/src/expr-int.h index 6c37fa20..1f0ed2df 100644 --- a/src/expr-int.h +++ b/src/expr-int.h @@ -86,7 +86,7 @@ int expr_traverse_leaves_in(expr *e, /*@null@*/ void *d, void expr_order_terms(expr *e); /* Copy entire expression EXCEPT for index "except" at *top level only*. */ -/*@null@*/ expr *expr_copy_except(const expr *e, int except); +expr *expr_copy_except(const expr *e, int except); int expr_contains(expr *e, ExprType t); diff --git a/src/expr.c b/src/expr.c index 4da07dc9..5273c241 100644 --- a/src/expr.c +++ b/src/expr.c @@ -42,7 +42,7 @@ static int expr_traverse_nodes_post(/*@null@*/ expr *e, /*@null@*/ void *d, /* allocate a new expression node, with children as defined. * If it's a unary operator, put the element in left and set right=NULL. */ -/*@-usedef@*/ +/*@-compmempass@*/ expr * expr_new(ExprOp op, ExprItem *left, ExprItem *right) { @@ -95,7 +95,7 @@ expr_new(ExprOp op, ExprItem *left, ExprItem *right) return ptr; } -/*@=usedef@*/ +/*@=compmempass@*/ /* helpers */ ExprItem * @@ -627,9 +627,6 @@ expr_copy_except(const expr *e, int except) expr *n; int i; - if (!e) - return 0; - n = xmalloc(sizeof(expr)+sizeof(ExprItem)*(e->numterms<2?0:e->numterms-2)); n->op = e->op; diff --git a/src/expr.h b/src/expr.h index d76a5d4f..3403edb2 100644 --- a/src/expr.h +++ b/src/expr.h @@ -41,7 +41,7 @@ typedef struct ExprItem ExprItem; expr_new (EXPR_IDENT, (r), (ExprItem *)NULL) /* allocates and makes an exact duplicate of e */ -/*@null@*/ expr *expr_copy(const expr *e); +expr *expr_copy(const expr *e); void expr_delete(/*@only@*/ /*@null@*/ expr *e);