Submitter | Augie Fackler |
---|---|
Date | Dec. 31, 2015, 7:05 p.m. |
Message ID | <2cde05d091f1e053f4cf.1451588746@imladris.local> |
Download | mbox | patch |
Permalink | /patch/12450/ |
State | Changes Requested |
Delegated to: | Yuya Nishihara |
Headers | show |
Comments
On Thu, Dec 31, 2015 at 11:05 AM, Augie Fackler <raf@durin42.com> wrote: > needle.start = PyString_AsString(key); > + if (!needle.start) { > + return -1; > + } > This check is unnecessary as you've already done a PyString_Check a few lines earlier. In fact you can and should use PyString_AS_STRING for efficiency here instead.
Patch
diff --git a/mercurial/manifest.c b/mercurial/manifest.c --- a/mercurial/manifest.c +++ b/mercurial/manifest.c @@ -416,6 +416,9 @@ static int lazymanifest_delitem(lazymani return -1; } needle.start = PyString_AsString(key); + if (!needle.start) { + return -1; + } hit = bsearch(&needle, self->lines, self->numlines, sizeof(line), &linecmp); if (!hit || hit->deleted) {