]> granicus.if.org Git - graphviz/commitdiff
xlib plugin handle_file_events: rephrase a switch into an if
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 31 Mar 2022 00:21:22 +0000 (17:21 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 2 Apr 2022 19:55:48 +0000 (12:55 -0700)
Avoids a -Wswitch-default warnings and simplifies the code that was clearly
indicating an intent to ignore everything except `IN_MODIFY`.

plugin/xlib/gvdevice_xlib.c

index d448d37d4ae3192d23fbca72f09ae1acab98ee27..512a962fe6682fba893c155283cbda5fb37d4566 100644 (file)
@@ -431,8 +431,7 @@ static int handle_file_events(GVJ_t *job, int inotify_fd)
         bf = buf;
         while (len > 0) {
            event = (struct inotify_event *)bf;
-           switch (event->mask) {
-           case IN_MODIFY:
+           if (event->mask == IN_MODIFY) {
                p = strrchr(job->input_filename, '/');
                if (p)
                    p++;
@@ -442,25 +441,6 @@ static int handle_file_events(GVJ_t *job, int inotify_fd)
                    job->callbacks->read(job, job->input_filename, job->layout_type);
                    rc++;
                }
-               break;
-
-            case IN_ACCESS:
-            case IN_ATTRIB:
-            case IN_CLOSE_WRITE:
-            case IN_CLOSE_NOWRITE:
-            case IN_OPEN:
-            case IN_MOVED_FROM:
-            case IN_MOVED_TO:
-            case IN_CREATE:
-            case IN_DELETE:
-            case IN_DELETE_SELF:
-            case IN_MOVE_SELF:
-            case IN_UNMOUNT:
-            case IN_Q_OVERFLOW:
-            case IN_IGNORED:
-            case IN_ISDIR:
-            case IN_ONESHOT:
-               break;
            }
            ln = event->len + sizeof(struct inotify_event);
             bf += ln;