You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand that netstrings are used mainly as lists, so I thought that we could enhance the sequential reading of strings in a netstring list.
In the current code we don't know how much remaining bytes are there to call netstring_read again. Off course we can calculate it but I guess that less code is better.
I forked the repo and made some changes. With it we can iterate a list with code like this:
Now I added the netstring_add function. It supports adding many strings to a netstring list (it concatenates them).
char *netstring=0; /* we must initialize it to zero */
netstring_add(&netstring, "first");
netstring_add(&netstring, "second");
netstring_add(&netstring, "third");
I guess it is better than using netstring_encode_new because with this one we have to concatenate the result by ourselves.
Hi!
Thank you for sharing your code!
I understand that netstrings are used mainly as lists, so I thought that we could enhance the sequential reading of strings in a netstring list.
In the current code we don't know how much remaining bytes are there to call
netstring_read
again. Off course we can calculate it but I guess that less code is better.I forked the repo and made some changes. With it we can iterate a list with code like this:
If you think it is useful I can make a pull request.
It will break the current ABI, so it can have a new version.
Thank you again!
The text was updated successfully, but these errors were encountered: