Lines Matching refs:cpfds
401 void Curl_pollfds_init(struct curl_pollfds *cpfds, in Curl_pollfds_init() argument
405 DEBUGASSERT(cpfds); in Curl_pollfds_init()
406 memset(cpfds, 0, sizeof(*cpfds)); in Curl_pollfds_init()
408 cpfds->pfds = static_pfds; in Curl_pollfds_init()
409 cpfds->count = static_count; in Curl_pollfds_init()
413 void Curl_pollfds_cleanup(struct curl_pollfds *cpfds) in Curl_pollfds_cleanup() argument
415 DEBUGASSERT(cpfds); in Curl_pollfds_cleanup()
416 if(cpfds->allocated_pfds) { in Curl_pollfds_cleanup()
417 free(cpfds->pfds); in Curl_pollfds_cleanup()
419 memset(cpfds, 0, sizeof(*cpfds)); in Curl_pollfds_cleanup()
422 static CURLcode cpfds_increase(struct curl_pollfds *cpfds, unsigned int inc) in cpfds_increase() argument
425 unsigned int new_count = cpfds->count + inc; in cpfds_increase()
431 memcpy(new_fds, cpfds->pfds, cpfds->count * sizeof(struct pollfd)); in cpfds_increase()
432 if(cpfds->allocated_pfds) in cpfds_increase()
433 free(cpfds->pfds); in cpfds_increase()
434 cpfds->pfds = new_fds; in cpfds_increase()
435 cpfds->count = new_count; in cpfds_increase()
436 cpfds->allocated_pfds = TRUE; in cpfds_increase()
440 static CURLcode cpfds_add_sock(struct curl_pollfds *cpfds, in cpfds_add_sock() argument
445 if(fold && cpfds->n <= INT_MAX) { in cpfds_add_sock()
446 for(i = (int)cpfds->n - 1; i >= 0; --i) { in cpfds_add_sock()
447 if(sock == cpfds->pfds[i].fd) { in cpfds_add_sock()
448 cpfds->pfds[i].events |= events; in cpfds_add_sock()
454 if(cpfds->n >= cpfds->count) { in cpfds_add_sock()
455 if(cpfds_increase(cpfds, 100)) in cpfds_add_sock()
458 cpfds->pfds[cpfds->n].fd = sock; in cpfds_add_sock()
459 cpfds->pfds[cpfds->n].events = events; in cpfds_add_sock()
460 ++cpfds->n; in cpfds_add_sock()
464 CURLcode Curl_pollfds_add_sock(struct curl_pollfds *cpfds, in Curl_pollfds_add_sock() argument
467 return cpfds_add_sock(cpfds, sock, events, FALSE); in Curl_pollfds_add_sock()
470 CURLcode Curl_pollfds_add_ps(struct curl_pollfds *cpfds, in Curl_pollfds_add_ps() argument
475 DEBUGASSERT(cpfds); in Curl_pollfds_add_ps()
484 if(cpfds_add_sock(cpfds, ps->sockets[i], events, TRUE)) in Curl_pollfds_add_ps()