Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thoughts on the preserve newlines patch #54

Open
NathanTech7713 opened this issue Dec 13, 2021 · 0 comments
Open

Thoughts on the preserve newlines patch #54

NathanTech7713 opened this issue Dec 13, 2021 · 0 comments

Comments

@NathanTech7713
Copy link

Hi there,

I was wondering if the experts of the server side world would take a look at the preserve newlines patch, I've uploaded it with this issue.
Now, obviously, the patch itself is wildly out of date, especially considering it was made for lambdamoo, not toast.
But I wanted to touch on the principle of the matter in so far as how it escapes the \n and \r\n strings to stop the breaking of the database structure overall.
In toaststunt, I've seen it put ~0A in place of newlines in exec for instance, so would this work for the case of this patch?
EG instead of:
case '\n':
fputc('\0', output);
fputc('n', output);
You'd have:
fputc('~0A1', output);

I'm assuming it'd have to be a call to fputc for each character in ~0A1 but you get the idea.
My questions are:

  1. Would this be safe? How much of a chance does this have of taking database integrity and tossing it out of the nearest window.
  2. Surely there's a more efficient way to do it than iterating through each character and calling fputc? Maybe I'm coming from a python background and not realising how much heavily lifting c can do but that seems... Inefficient at best?

Thoughts welcome.
preserve-newlines.patch.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant