1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

wmaker: Removed non necessary macro for buffer size

The C language provides the macro 'sizeof' to handle this kind of
situation, so do not create locally a macro which can become a source
of problems.

Took opportunity to change the size of buffer to follow guidelines
from Inotify's manpage, and to remove the initial value that is useless.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2013-10-13 15:41:58 +02:00
committed by Carlos R. Mafra
parent bec778aae2
commit 1b2f3c0431

View File

@@ -291,12 +291,11 @@ void DispatchEvent(XEvent * event)
* Calls wDefaultsCheckDomains if config database is updated * Calls wDefaultsCheckDomains if config database is updated
*---------------------------------------------------------------------- *----------------------------------------------------------------------
*/ */
/* allow 5 simultaneous events, with path + filenames up to 64 chars */
#define BUFF_SIZE ((sizeof(struct inotify_event) + 64)*5)
static void handle_inotify_events(void) static void handle_inotify_events(void)
{ {
ssize_t eventQLength, i = 0; ssize_t eventQLength, i = 0;
char buff[BUFF_SIZE] = { 0 }; /* Make room for at lease 5 simultaneous events, with path + filenames */
char buff[ (sizeof(struct inotify_event) + NAME_MAX + 1) * 5 ];
/* Check config only once per read of the event queue */ /* Check config only once per read of the event queue */
int oneShotFlag = 0; int oneShotFlag = 0;
@@ -308,7 +307,7 @@ static void handle_inotify_events(void)
* a few entries before a read(). * a few entries before a read().
*/ */
eventQLength = read(w_global.inotify.fd_event_queue, eventQLength = read(w_global.inotify.fd_event_queue,
buff, BUFF_SIZE); buff, sizeof(buff) );
/* check what events occured */ /* check what events occured */
/* Should really check wd here too, but for now we only have one watch! */ /* Should really check wd here too, but for now we only have one watch! */