2 * sparse/check_memset.c
4 * Copyright (C) 2011 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
14 static void match_memset(const char *fn
, struct expression
*expr
, void *data
)
16 struct expression
*arg_expr
;
19 arg_expr
= get_argument_from_call_expr(expr
->args
, 2);
21 if (arg_expr
->type
!= EXPR_VALUE
)
23 if (!get_value(arg_expr
, &sval
))
27 sm_msg("error: calling memset(x, y, 0);");
30 void check_memset(int id
)
33 add_function_hook("memset", &match_memset
, NULL
);
34 add_function_hook("__builtin_memset", &match_memset
, NULL
);