CodeQL LargeParameter.ql: large objects returned (around fd_set usage)
now using pointers (fd_set*) constify API where possible
This commit is contained in:
parent
6a537c4659
commit
99c448407c
|
|
@ -138,22 +138,22 @@ static TxCommand *lisp_cur_cmd = NULL;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
FD_IsZero(fdmask)
|
FD_IsZero(fdmask)
|
||||||
fd_set fdmask;
|
const fd_set *fdmask;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i <= TX_MAX_OPEN_FILES; i++)
|
for (i = 0; i <= TX_MAX_OPEN_FILES; i++)
|
||||||
if (FD_ISSET(i, &fdmask)) return FALSE;
|
if (FD_ISSET(i, fdmask)) return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FD_OrSet(fdmask, dst)
|
FD_OrSet(fdmask, dst)
|
||||||
fd_set fdmask;
|
const fd_set *fdmask;
|
||||||
fd_set *dst;
|
fd_set *dst;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i <= TX_MAX_OPEN_FILES; i++)
|
for (i = 0; i <= TX_MAX_OPEN_FILES; i++)
|
||||||
if (FD_ISSET(i, &fdmask)) FD_SET(i, dst);
|
if (FD_ISSET(i, fdmask)) FD_SET(i, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -454,7 +454,7 @@ TxFreeCommand(command)
|
||||||
|
|
||||||
void
|
void
|
||||||
TxAddInputDevice(fdmask, inputProc, cdata)
|
TxAddInputDevice(fdmask, inputProc, cdata)
|
||||||
fd_set fdmask; /* A mask of file descriptors that this
|
const fd_set *fdmask; /* A mask of file descriptors that this
|
||||||
* device will handle.
|
* device will handle.
|
||||||
*/
|
*/
|
||||||
void (*inputProc)(); /* A routine to call. This routine will
|
void (*inputProc)(); /* A routine to call. This routine will
|
||||||
|
|
@ -475,7 +475,7 @@ TxAddInputDevice(fdmask, inputProc, cdata)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
txLastInputEntry++;
|
txLastInputEntry++;
|
||||||
txInputDevice[txLastInputEntry].tx_fdmask = fdmask;
|
txInputDevice[txLastInputEntry].tx_fdmask = *fdmask;
|
||||||
txInputDevice[txLastInputEntry].tx_inputProc = inputProc;
|
txInputDevice[txLastInputEntry].tx_inputProc = inputProc;
|
||||||
txInputDevice[txLastInputEntry].tx_cdata = cdata;
|
txInputDevice[txLastInputEntry].tx_cdata = cdata;
|
||||||
FD_OrSet(fdmask, &txInputDescriptors);
|
FD_OrSet(fdmask, &txInputDescriptors);
|
||||||
|
|
@ -490,7 +490,7 @@ TxAdd1InputDevice(fd, inputProc, cdata)
|
||||||
fd_set fs;
|
fd_set fs;
|
||||||
FD_ZERO(&fs);
|
FD_ZERO(&fs);
|
||||||
FD_SET(fd, &fs);
|
FD_SET(fd, &fs);
|
||||||
TxAddInputDevice(fs, inputProc, cdata);
|
TxAddInputDevice(&fs, inputProc, cdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -509,14 +509,14 @@ TxAdd1InputDevice(fd, inputProc, cdata)
|
||||||
|
|
||||||
void
|
void
|
||||||
TxDeleteInputDevice(fdmask)
|
TxDeleteInputDevice(fdmask)
|
||||||
fd_set fdmask; /* A mask of file descriptors that are
|
const fd_set *fdmask; /* A mask of file descriptors that are
|
||||||
* no longer active.
|
* no longer active.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i <= TX_MAX_OPEN_FILES; i++)
|
for (i = 0; i <= TX_MAX_OPEN_FILES; i++)
|
||||||
if (FD_ISSET(i, &fdmask)) TxDelete1InputDevice(i);
|
if (FD_ISSET(i, fdmask)) TxDelete1InputDevice(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -528,7 +528,7 @@ TxDelete1InputDevice(fd)
|
||||||
for (i = 0; i <= txLastInputEntry; i++)
|
for (i = 0; i <= txLastInputEntry; i++)
|
||||||
{
|
{
|
||||||
FD_CLR(fd, &(txInputDevice[i].tx_fdmask));
|
FD_CLR(fd, &(txInputDevice[i].tx_fdmask));
|
||||||
if (FD_IsZero(txInputDevice[i].tx_fdmask))
|
if (FD_IsZero(&txInputDevice[i].tx_fdmask))
|
||||||
{
|
{
|
||||||
for (j = i+1; j <= txLastInputEntry; j++)
|
for (j = i+1; j <= txLastInputEntry; j++)
|
||||||
txInputDevice[j-1] = txInputDevice[j];
|
txInputDevice[j-1] = txInputDevice[j];
|
||||||
|
|
@ -940,7 +940,7 @@ TxGetInputEvent(block, returnOnSigWinch)
|
||||||
bool gotSome;
|
bool gotSome;
|
||||||
int i, fd, lastNum;
|
int i, fd, lastNum;
|
||||||
|
|
||||||
ASSERT(!FD_IsZero(txInputDescriptors), "TxGetInputEvent");
|
ASSERT(!FD_IsZero(&txInputDescriptors), "TxGetInputEvent");
|
||||||
|
|
||||||
if (block)
|
if (block)
|
||||||
waitTime = NULL;
|
waitTime = NULL;
|
||||||
|
|
|
||||||
|
|
@ -118,9 +118,9 @@ extern TxCommand TxCurCommand;
|
||||||
|
|
||||||
extern TxCommand *TxDeviceStdin();
|
extern TxCommand *TxDeviceStdin();
|
||||||
extern TxCommand *TxButtonMaskToCommand();
|
extern TxCommand *TxButtonMaskToCommand();
|
||||||
extern void TxAddInputDevice(); /* Can read multiple file desc. */
|
extern void TxAddInputDevice(const fd_set *fdmask, void (*inputProc)(), ClientData cdata); /* Can read multiple file desc. */
|
||||||
extern void TxAdd1InputDevice(); /* Can read only 1 file desc. */
|
extern void TxAdd1InputDevice(); /* Can read only 1 file desc. */
|
||||||
extern void TxDeleteInputDevice();
|
extern void TxDeleteInputDevice(const fd_set *fdmask);
|
||||||
extern void TxDelete1InputDevice();
|
extern void TxDelete1InputDevice();
|
||||||
|
|
||||||
/* Routines to manipulate the current point. Only really used for command
|
/* Routines to manipulate the current point. Only really used for command
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue