-
Notifications
You must be signed in to change notification settings - Fork 467
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
A question in sdsIncrLen #39
Comments
Yeah, the only thing that could make it be less than 0 would be in a multithreaded programs where two threads are trying to modify the same string at once, but that’d be very broken. Anyway, @antirez seems to have no intention of maintaining SDS and I emailed him a couple of months ago about it but he never replied, so I’m working on a fork currently located at https://github.com/yabok/sds, though it will be moved to (most likely) https://github.com/yabok/yasl soon. |
See pull request #45 for a fix. |
@lemzwerg If you look at the repo history and the other PRs and issues open you can see how it's pretty useless to open a PR on this repo. |
Maybe, yes. However, the PRs I produce are just a byproduct and quite easy to generate, so why not. I'm used to normally commit code with associated ChangeLog entries; this essentially means that you have to concisely wrap up your modifications in an atomic way – in most cases this already corresponds to a PR... |
In the function sdsIncrLen, I think the statement "assert(sh->free >= 0) " is redundant, because "assert(sh->free >= incr)" makes sure this situation would not happen.
void sdsIncrLen(sds s, int incr) {
struct sdshdr sh = (void)(s - sizeof *sh);
assert(sh->free >= incr);
sh->len += incr;
sh->free -= incr;
assert(sh->free >= 0);
s[sh->len] = '\0';
}
The text was updated successfully, but these errors were encountered: