mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-30 16:10:44 +08:00
Fix LGTM detected errors
This commit is contained in:
parent
59e04ae071
commit
999c291020
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user