1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

add_next_timeout: minor restructure of code

By reading the ->head pointer and using that instead of the ->size
number to figure out if there's a list remaining we avoid the (false
positive) clang-analyzer warning that we might dereference of a null
pointer.
This commit is contained in:
Daniel Stenberg 2012-08-08 14:50:32 +02:00
parent bf6dc61967
commit 14afbf361a

View File

@ -2079,14 +2079,14 @@ static CURLMcode add_next_timeout(struct timeval now,
break; break;
e = n; e = n;
} }
if(!list->size) { e = list->head;
if(!e) {
/* clear the expire times within the handles that we remove from the /* clear the expire times within the handles that we remove from the
splay tree */ splay tree */
tv->tv_sec = 0; tv->tv_sec = 0;
tv->tv_usec = 0; tv->tv_usec = 0;
} }
else { else {
e = list->head;
/* copy the first entry to 'tv' */ /* copy the first entry to 'tv' */
memcpy(tv, e->ptr, sizeof(*tv)); memcpy(tv, e->ptr, sizeof(*tv));