diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-11-25 17:14:19 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-11-25 17:14:19 +0000 |
commit | 7eb250e9c52813f30fef256b97f08a6871fd381a (patch) | |
tree | 434da79bcc882cb0d88a7db1ad71003b51aad091 /select.c | |
parent | 98b5453ecdd6a474ba8c3495285e607d5b7a8e57 (diff) | |
download | libevent-7eb250e9c52813f30fef256b97f08a6871fd381a.tar.gz |
r14939@tombo: nickm | 2007-11-25 11:59:26 -0500
New function event_set_mem_functions to replace internal calls to malloc, free, etc with a user-supplied functions.
svn:r541
Diffstat (limited to 'select.c')
-rw-r--r-- | select.c | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -98,7 +98,7 @@ select_init(struct event_base *base) if (getenv("EVENT_NOSELECT")) return (NULL); - if (!(sop = calloc(1, sizeof(struct selectop)))) + if (!(sop = event_calloc(1, sizeof(struct selectop)))) return (NULL); select_resize(sop, howmany(32 + 1, NFDBITS)*sizeof(fd_mask)); @@ -229,23 +229,23 @@ select_resize(struct selectop *sop, int fdsz) if (sop->event_readset_in) check_selectop(sop); - if ((readset_in = realloc(sop->event_readset_in, fdsz)) == NULL) + if ((readset_in = event_realloc(sop->event_readset_in, fdsz)) == NULL) goto error; sop->event_readset_in = readset_in; - if ((readset_out = realloc(sop->event_readset_out, fdsz)) == NULL) + if ((readset_out = event_realloc(sop->event_readset_out, fdsz)) == NULL) goto error; sop->event_readset_out = readset_out; - if ((writeset_in = realloc(sop->event_writeset_in, fdsz)) == NULL) + if ((writeset_in = event_realloc(sop->event_writeset_in, fdsz)) == NULL) goto error; sop->event_writeset_in = writeset_in; - if ((writeset_out = realloc(sop->event_writeset_out, fdsz)) == NULL) + if ((writeset_out = event_realloc(sop->event_writeset_out, fdsz)) == NULL) goto error; sop->event_writeset_out = writeset_out; - if ((r_by_fd = realloc(sop->event_r_by_fd, + if ((r_by_fd = event_realloc(sop->event_r_by_fd, n_events*sizeof(struct event*))) == NULL) goto error; sop->event_r_by_fd = r_by_fd; - if ((w_by_fd = realloc(sop->event_w_by_fd, + if ((w_by_fd = event_realloc(sop->event_w_by_fd, n_events * sizeof(struct event*))) == NULL) goto error; sop->event_w_by_fd = w_by_fd; @@ -355,18 +355,18 @@ select_dealloc(struct event_base *base, void *arg) evsignal_dealloc(base); if (sop->event_readset_in) - free(sop->event_readset_in); + event_free(sop->event_readset_in); if (sop->event_writeset_in) - free(sop->event_writeset_in); + event_free(sop->event_writeset_in); if (sop->event_readset_out) - free(sop->event_readset_out); + event_free(sop->event_readset_out); if (sop->event_writeset_out) - free(sop->event_writeset_out); + event_free(sop->event_writeset_out); if (sop->event_r_by_fd) - free(sop->event_r_by_fd); + event_free(sop->event_r_by_fd); if (sop->event_w_by_fd) - free(sop->event_w_by_fd); + event_free(sop->event_w_by_fd); memset(sop, 0, sizeof(struct selectop)); - free(sop); + event_free(sop); } |