]> granicus.if.org Git - strace/commitdiff
fcntl: replace combinations of xlookup and printxval with printxvals
authorEugene Syromyatnikov <evgsyr@gmail.com>
Wed, 4 Apr 2018 12:12:08 +0000 (14:12 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 24 Apr 2018 00:35:27 +0000 (00:35 +0000)
After all, that's what printxvals for.

* fcntl.c (SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): Use printxvals for
printing value with multiple xlat tables as constant sources.

fcntl.c

diff --git a/fcntl.c b/fcntl.c
index a42489bd8059805d77533177a1a7ba5b3594fc99..3abce7fd779906cf7294d5c9ef011d1a8e66eeb7 100644 (file)
--- a/fcntl.c
+++ b/fcntl.c
@@ -198,17 +198,13 @@ SYS_FUNC(fcntl)
                printfd(tcp, tcp->u_arg[0]);
                tprints(", ");
                const unsigned int cmd = tcp->u_arg[1];
-               const char *str = xlookup(fcntlcmds, cmd);
-               if (str) {
-                       tprints(str);
-               } else {
-                       /*
-                        * fcntl syscall does not recognize these
-                        * constants, but we would like to show them
-                        * for better debugging experience.
-                        */
-                       printxval(fcntl64cmds, cmd, "F_???");
-               }
+
+               /*
+                * fcntl syscall does not recognize fcntl64 command constants,
+                * but we would like to show them for better debugging
+                * experience.
+                */
+               printxvals(cmd, "F_???", fcntlcmds, fcntl64cmds, NULL);
        }
        return print_fcntl(tcp);
 }
@@ -219,12 +215,7 @@ SYS_FUNC(fcntl64)
        if (entering(tcp)) {
                printfd(tcp, tcp->u_arg[0]);
                tprints(", ");
-               const char *str = xlookup(fcntl64cmds, cmd);
-               if (str) {
-                       tprints(str);
-               } else {
-                       printxval(fcntlcmds, cmd, "F_???");
-               }
+               printxvals(cmd, "F_???", fcntl64cmds, fcntlcmds, NULL);
        }
        switch (cmd) {
                case F_SETLK64: