Print this page
11506 smatch resync
*** 37,73 ****
}
static void match_call(struct expression *expr)
{
struct expression *arg;
! struct symbol *type;
int size, bytes;
int i, nr;
char buf[16];
i = -1;
FOR_EACH_PTR(expr->args, arg) {
i++;
type = get_type(arg);
if (!type || (type->type != SYM_PTR && type->type != SYM_ARRAY))
continue;
size = get_array_size(arg);
if (size > 0) {
nr = find_param_eq(expr, size);
if (nr >= 0) {
! snprintf(buf, sizeof(buf), "%d", nr);
! sql_insert_caller_info(expr, ARRAYSIZE_ARG, i, buf, "");
continue;
}
}
bytes = get_array_size_bytes(arg);
if (bytes > 0) {
nr = find_param_eq(expr, bytes);
if (nr >= 0) {
! snprintf(buf, sizeof(buf), "%d", nr);
! sql_insert_caller_info(expr, SIZEOF_ARG, i, buf, "");
continue;
}
}
} END_FOR_EACH_PTR(arg);
}
--- 37,81 ----
}
static void match_call(struct expression *expr)
{
struct expression *arg;
! struct symbol *type, *arg_type;
int size, bytes;
int i, nr;
char buf[16];
+ char elem_count[8];
+ char byte_count[8];
+ snprintf(elem_count, sizeof(elem_count), "%d", ELEM_COUNT);
+ snprintf(byte_count, sizeof(byte_count), "%d", BYTE_COUNT);
i = -1;
FOR_EACH_PTR(expr->args, arg) {
i++;
type = get_type(arg);
if (!type || (type->type != SYM_PTR && type->type != SYM_ARRAY))
continue;
+ arg_type = get_arg_type(expr->fn, i);
+ if (arg_type != type)
+ continue;
+
size = get_array_size(arg);
if (size > 0) {
nr = find_param_eq(expr, size);
if (nr >= 0) {
! snprintf(buf, sizeof(buf), "==$%d", nr);
! sql_insert_caller_info(expr, ELEM_COUNT, i, buf, elem_count);
continue;
}
}
bytes = get_array_size_bytes(arg);
if (bytes > 0) {
nr = find_param_eq(expr, bytes);
if (nr >= 0) {
! snprintf(buf, sizeof(buf), "==$%d", nr);
! sql_insert_caller_info(expr, BYTE_COUNT, i, buf, byte_count);
continue;
}
}
} END_FOR_EACH_PTR(arg);
}