Fix LGTM detected errors

This commit is contained in:
Dennis Heimbigner 2020-06-28 18:59:53 -06:00
parent 59e04ae071
commit 999c291020
2 changed files with 6 additions and 6 deletions

View File

@ -329,15 +329,15 @@ parseonchar(const char* s, int ch, NClist* segments)
p = s;
for(;;) {
char* s;
char* q;
ptrdiff_t slen;
endp = strchr(p,ch);
if(endp == NULL) endp = p + strlen(p);
slen = (endp - p);
if((s = malloc(slen+1)) == NULL) {stat = NC_ENOMEM; goto done;}
memcpy(s,p,slen);
s[slen] = '\0';
nclistpush(segments,s);
if((q = malloc(slen+1)) == NULL) {stat = NC_ENOMEM; goto done;}
memcpy(q,p,slen);
q[slen] = '\0';
nclistpush(segments,q);
if(*endp == '\0') break;
p = endp+1;
}

View File

@ -315,7 +315,7 @@ int
NC_hashmapith(NC_hashmap* map, size_t i, uintptr_t* datap, const char** keyp)
{
NC_hentry* h = NULL;
if(map == NULL || i < 0 || i >= map->alloc) return NC_EINVAL;
if(map == NULL || i >= map->alloc) return NC_EINVAL;
h = &map->table[i];
if(h && (h->flags & ACTIVE)) {
if(datap) *datap = h->data;