* [Tarantool-patches] [PATCH 1/1] fk: fix wrong sizeof() in fk_constraint_def_sizeof()
@ 2020-05-27 23:25 Vladislav Shpilevoy
2020-05-28 7:24 ` Kirill Yukhin
0 siblings, 1 reply; 2+ messages in thread
From: Vladislav Shpilevoy @ 2020-05-27 23:25 UTC (permalink / raw)
To: tarantool-patches, korablev
The function returns a number of bytes needed to store
an fk_constraint_def object with its name and links.
However it used sizeof(struct fk_constraint) instead
of sizeof(struct fk_constraint_def) to calculate
base object size. This worked only because
fk_constraint is bigger than fk_constraint_def.
---
Branch: http://github.com/tarantool/tarantool/tree/gerold103/fk_constraint_sizeof
src/box/fk_constraint.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/box/fk_constraint.h b/src/box/fk_constraint.h
index fee82afb0..b1e0cfb84 100644
--- a/src/box/fk_constraint.h
+++ b/src/box/fk_constraint.h
@@ -131,7 +131,7 @@ struct fk_constraint {
static inline size_t
fk_constraint_def_sizeof(uint32_t link_count, uint32_t name_len)
{
- return sizeof(struct fk_constraint) +
+ return sizeof(struct fk_constraint_def) +
link_count * sizeof(struct field_link) +
name_len + 1;
}
--
2.21.1 (Apple Git-122.3)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Tarantool-patches] [PATCH 1/1] fk: fix wrong sizeof() in fk_constraint_def_sizeof()
2020-05-27 23:25 [Tarantool-patches] [PATCH 1/1] fk: fix wrong sizeof() in fk_constraint_def_sizeof() Vladislav Shpilevoy
@ 2020-05-28 7:24 ` Kirill Yukhin
0 siblings, 0 replies; 2+ messages in thread
From: Kirill Yukhin @ 2020-05-28 7:24 UTC (permalink / raw)
To: Vladislav Shpilevoy; +Cc: tarantool-patches
Hello,
On 28 май 01:25, Vladislav Shpilevoy wrote:
> The function returns a number of bytes needed to store
> an fk_constraint_def object with its name and links.
> However it used sizeof(struct fk_constraint) instead
> of sizeof(struct fk_constraint_def) to calculate
> base object size. This worked only because
> fk_constraint is bigger than fk_constraint_def.
> ---
> Branch: http://github.com/tarantool/tarantool/tree/gerold103/fk_constraint_sizeof
Checked into 2.3, 2.4 and master as obvious.
--
Regards, Kirill Yukhin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-28 7:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 23:25 [Tarantool-patches] [PATCH 1/1] fk: fix wrong sizeof() in fk_constraint_def_sizeof() Vladislav Shpilevoy
2020-05-28 7:24 ` Kirill Yukhin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox