1 | /* |
1 | /* |
2 | * libev poll fd activity backend |
2 | * libev poll fd activity backend |
3 | * |
3 | * |
4 | * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de> |
4 | * Copyright (c) 2007,2008,2009,2010,2011,2016,2019 Marc Alexander Lehmann <libev@schmorp.de> |
5 | * All rights reserved. |
5 | * All rights reserved. |
6 | * |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
8 | * tion, are permitted provided that the following conditions are met: |
8 | * tion, are permitted provided that the following conditions are met: |
9 | * |
9 | * |
… | |
… | |
62 | idx = pollidxs [fd]; |
62 | idx = pollidxs [fd]; |
63 | |
63 | |
64 | if (idx < 0) /* need to allocate a new pollfd */ |
64 | if (idx < 0) /* need to allocate a new pollfd */ |
65 | { |
65 | { |
66 | pollidxs [fd] = idx = pollcnt++; |
66 | pollidxs [fd] = idx = pollcnt++; |
67 | array_needsize (struct pollfd, polls, pollmax, pollcnt, EMPTY2); |
67 | array_needsize (struct pollfd, polls, pollmax, pollcnt, array_needsize_noinit); |
68 | polls [idx].fd = fd; |
68 | polls [idx].fd = fd; |
69 | } |
69 | } |
70 | |
70 | |
71 | assert (polls [idx].fd == fd); |
71 | assert (polls [idx].fd == fd); |
72 | |
72 | |