Skip to content

Conversation

@Noremos
Copy link
Contributor

@Noremos Noremos commented Jun 18, 2025

This is also a preparation for the JSON Type implementation

src/common/dsc.h Outdated
{
return isText(); // TODO: add isJson();
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not look proper to me, as CHAR is not dynamic-length generally (except inside the impure). IMHO, it should be up to the caller (impure class) to check what string types are stored as variable-length.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By this method I mean that dsc_length of content is not fixed. Now I remembered that there is an array type_lengths that checks exactly this, so I replace this method with the array

src/jrd/evl.cpp Outdated
string = value->vlu_string = FB_NEW_RPT(*pool, length) VaryingString();
string->str_length = length;
}
VaryingString* string = value->getAllocateString(from.dsc_length, *pool);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be value->getAllocateString(length, *pool) ?

src/jrd/val.h Outdated

template<class T>
VaryingString* getAllocateString(T requeuedLength, MemoryPool& pool) = delete; // Prevent dangerous length shrink
VaryingString* getAllocateString(USHORT requeuedLength, MemoryPool& pool);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd call it just getString() for simplicity but I'm not going to insist.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAllocateString is not a name that sounds good.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually pool comes first in parameter list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the name to getString with the pool as the first parameter

src/jrd/val.h Outdated
VaryingString* getAllocateString(USHORT requeuedLength, MemoryPool& pool);

void makeImpureDscAddress(MemoryPool& pool);
void allocateTextImpureDscAddress(MemoryPool& pool);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're already inside the impure class, so please simplify the names, e.g. makeDscAddress() / setupDynamicDscAddress().

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These names are weird and maybe due to it, the methods too.
With current names, I prefer the original code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Names are my weak point. I tried others in the last commit, but it would be nice to get your suggestions.

src/jrd/val.h Outdated
this->vlu_desc.dsc_address = reinterpret_cast<UCHAR*>(&this->vlu_misc.vlu_int128);
}

inline VaryingString* impure_value::getAllocateString(USHORT requeuedLength, MemoryPool& pool)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest newLength or just length instead of requeuedLength.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@dyemanov dyemanov merged commit 95a4d87 into FirebirdSQL:master Jun 27, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants