antirez / antirez/sds

A question in sdsIncrLen

Open
#39 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
5.6k
Forks
510
PR merge metrics
No merged PRs in 30d

Description

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';
}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.