diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2020-10-11 18:03:53 +0200 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2021-06-20 20:12:50 +0200 |
commit | 6753eb5928cf8a70317f0b1304bf4705309548ef (patch) | |
tree | 542e9011b28dad0249b7bcfa14b7d97777ef7d5d /nx-X11 | |
parent | d32b4f5b1a55e0bbca79701d2b89bede331fed75 (diff) | |
download | nx-libs-6753eb5928cf8a70317f0b1304bf4705309548ef.tar.gz nx-libs-6753eb5928cf8a70317f0b1304bf4705309548ef.tar.bz2 nx-libs-6753eb5928cf8a70317f0b1304bf4705309548ef.zip |
Clipboard.c: use for loops everywhere.
Diffstat (limited to 'nx-X11')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 74ed61d7f..cd3a890d0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -665,6 +665,7 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) * Only for PRIMARY and CLIPBOARD selections. */ + /* FIXME: there's almost identical code in nxagentClipboardInit */ for (int index = 0; index < nxagentMaxSelections; index++) { if (matchSelectionOwner(index, pClient, pWindow)) @@ -694,13 +695,14 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) */ int nxagentFindLastSelectionOwnerIndex(XlibAtom sel) { - int index = 0; - while (index < nxagentMaxSelections && - lastSelectionOwner[index].remSelection != sel) + for (int index = 0; index < nxagentMaxSelections; index++) { - index++; + if (lastSelectionOwner[index].remSelection == sel) + { + return index; + } } - return index; + return nxagentMaxSelections; } /* @@ -709,13 +711,14 @@ int nxagentFindLastSelectionOwnerIndex(XlibAtom sel) */ int nxagentFindCurrentSelectionIndex(Atom sel) { - int index = 0; - while (index < NumCurrentSelections && - CurrentSelections[index].selection != sel) + for (int index = 0; index < NumCurrentSelections; index++) { - index++; + if (CurrentSelections[index].selection == sel) + { + return index; + } } - return index; + return NumCurrentSelections; } /* |