diff options
author | Ken Brown <kbrown@cornell.edu> | 2020-08-26 18:21:20 -0400 |
---|---|---|
committer | Ken Brown <kbrown@cornell.edu> | 2020-08-27 07:14:19 -0400 |
commit | 49a9ffdf4bcb3388cde5e4f441dd710701136ba7 (patch) | |
tree | 46642fad084512c7b02405d6ee330280a4d5218a | |
parent | 573dda0cf2efa947a9c3d665abc1d94a0d600a9e (diff) | |
download | cygnal-49a9ffdf4bcb3388cde5e4f441dd710701136ba7.tar.gz cygnal-49a9ffdf4bcb3388cde5e4f441dd710701136ba7.tar.bz2 cygnal-49a9ffdf4bcb3388cde5e4f441dd710701136ba7.zip |
Cygwin: fhandler_fifo::delete_client_handler: improve efficiency
Delete a client handler by swapping it with the last one in the list
instead of calling memmove.
-rw-r--r-- | winsup/cygwin/fhandler_fifo.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index b3c4c4a25..75c8406fe 100644 --- a/winsup/cygwin/fhandler_fifo.cc +++ b/winsup/cygwin/fhandler_fifo.cc @@ -377,14 +377,14 @@ fhandler_fifo::add_client_handler (bool new_pipe_instance) return 0; } -/* Always called with fifo_client_lock in place. */ +/* Always called with fifo_client_lock in place. Delete a + client_handler by swapping it with the last one in the list. */ void fhandler_fifo::delete_client_handler (int i) { fc_handler[i].close (); if (i < --nhandlers) - memmove (fc_handler + i, fc_handler + i + 1, - (nhandlers - i) * sizeof (fc_handler[i])); + fc_handler[i] = fc_handler[nhandlers]; } /* Delete handlers that we will never read from. Always called with |