[Tarantool-patches] [PATCH v1 19/21] sql: remove MEM_Dyn flag
Mergen Imeev
imeevma at tarantool.org
Mon Oct 25 11:54:58 MSK 2021
Thank you for the review! My answer and diff below. There will be a bit more
changes due to chages in the previous patch-sets.
On Fri, Oct 15, 2021 at 12:46:09AM +0200, Vladislav Shpilevoy wrote:
> Thanks for the patch!
>
> > diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
> > index 895003580..a001ac8c5 100644
> > --- a/src/box/sql/mem.c
> > +++ b/src/box/sql/mem.c
> > @@ -2689,15 +2623,12 @@ sqlVdbeMemPrettyPrint(Mem *pMem, char *zBuf)
> > if (pMem->type == MEM_TYPE_BIN) {
> > int i;
> > char c;
> > - if (f & MEM_Dyn) {
> > - c = 'z';
> > - assert((f & (MEM_Static|MEM_Ephem))==0);
> > - } else if (f & MEM_Static) {
> > + if (f & MEM_Static) {
>
> 1. != 0.
>
Fixed.
> > c = 't';
> > - assert((f & (MEM_Dyn|MEM_Ephem))==0);
> > + assert((f & MEM_Ephem) == 0);
> > } else if (f & MEM_Ephem) {
> > c = 'e';
> > - assert((f & (MEM_Static|MEM_Dyn))==0);
> > + assert((f & MEM_Static) == 0);
> > } else {
> > c = 's';
> > }
> > @@ -2721,15 +2652,12 @@ sqlVdbeMemPrettyPrint(Mem *pMem, char *zBuf)
> > } else if (pMem->type == MEM_TYPE_STR) {
> > int j, k;
> > zBuf[0] = ' ';
> > - if (f & MEM_Dyn) {
> > - zBuf[1] = 'z';
> > - assert((f & (MEM_Static|MEM_Ephem))==0);
> > - } else if (f & MEM_Static) {
> > + if (f & MEM_Static) {
>
> 2. != 0.
>
Fixed.
> > zBuf[1] = 't';
> > - assert((f & (MEM_Dyn|MEM_Ephem))==0);
> > + assert((f & MEM_Ephem)==0);
> > } else if (f & MEM_Ephem) {
> > zBuf[1] = 'e';
> > - assert((f & (MEM_Static|MEM_Dyn))==0);
> > + assert((f & MEM_Static)==0);
>
> 3. Spaces around == here and above.
Fixed.
Diff:
diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
index 4f550f3e4..4150a24f0 100644
--- a/src/box/sql/mem.c
+++ b/src/box/sql/mem.c
@@ -1854,7 +1854,7 @@ mem_append(struct Mem *mem, const char *value, uint32_t len)
if (len == 0)
return 0;
int new_size = mem->n + len;
- if (((mem->flags & (MEM_Static | MEM_Dyn | MEM_Ephem)) != 0) ||
+ if (((mem->flags & (MEM_Static | MEM_Ephem)) != 0) ||
mem->szMalloc < new_size) {
/*
* Force exponential buffer size growth to avoid having to call
@@ -2628,7 +2628,7 @@ sqlVdbeMemPrettyPrint(Mem *pMem, char *zBuf)
if (pMem->type == MEM_TYPE_BIN) {
int i;
char c;
- if (f & MEM_Static) {
+ if ((f & MEM_Static) != 0) {
c = 't';
assert((f & MEM_Ephem) == 0);
} else if (f & MEM_Ephem) {
@@ -2657,12 +2657,12 @@ sqlVdbeMemPrettyPrint(Mem *pMem, char *zBuf)
} else if (pMem->type == MEM_TYPE_STR) {
int j, k;
zBuf[0] = ' ';
- if (f & MEM_Static) {
+ if ((f & MEM_Static) != 0) {
zBuf[1] = 't';
- assert((f & MEM_Ephem)==0);
+ assert((f & MEM_Ephem) == 0);
} else if (f & MEM_Ephem) {
zBuf[1] = 'e';
- assert((f & MEM_Static)==0);
+ assert((f & MEM_Static) == 0);
} else {
zBuf[1] = 's';
}
diff --git a/src/box/sql/mem.h b/src/box/sql/mem.h
index 76ba666fd..d2e9cc135 100644
--- a/src/box/sql/mem.h
+++ b/src/box/sql/mem.h
@@ -225,8 +225,7 @@ mem_is_allocated(const struct Mem *mem)
static inline bool
mem_is_trivial(const struct Mem *mem)
{
- return mem->szMalloc == 0 && (mem->flags & MEM_Dyn) == 0 &&
- mem->type != MEM_TYPE_FRAME;
+ return mem->szMalloc == 0 && mem->type != MEM_TYPE_FRAME;
}
static inline bool
More information about the Tarantool-patches
mailing list