]> granicus.if.org Git - strace/commitdiff
Remove addflags
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sat, 10 Mar 2018 04:38:10 +0000 (05:38 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 1 Apr 2018 13:14:15 +0000 (13:14 +0000)
It has only single user and implementation of xlat styles for it would
lead to lots of code duplication.

* defs.h (addflags): Remove declaration.
* mem.c (print_mmap_flags): Convert addflags call into printflags64 with
non-zeroeness flags check.
* xlat.c (addflags): Remove.

defs.h
mem.c
xlat.c

diff --git a/defs.h b/defs.h
index abe81c335442a7fa018a224ff5094c8355dfdd83..8415d6b324bdfc87bee2d62b26c0819702cbd80d 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -582,7 +582,6 @@ extern int printargs(struct tcb *);
 extern int printargs_u(struct tcb *);
 extern int printargs_d(struct tcb *);
 
-extern void addflags(const struct xlat *, uint64_t);
 extern int printflags_ex(uint64_t, const char *, const struct xlat *, ...)
        ATTRIBUTE_SENTINEL;
 extern const char *sprintflags(const char *, const struct xlat *, uint64_t);
diff --git a/mem.c b/mem.c
index aeb4cae2b782061cbd17d68b88bb55e7403dca20..f79d67cd771476bc8d72062e43b39f4eb9e3352c 100644 (file)
--- a/mem.c
+++ b/mem.c
@@ -73,7 +73,10 @@ print_mmap_flags(kernel_ulong_t flags)
        const unsigned int hugetlb_value = flags & mask;
 
        flags &= ~mask;
-       addflags(mmap_flags, flags);
+       if (flags) {
+               tprints("|");
+               printflags64(mmap_flags, flags, NULL);
+       }
 
        if (hugetlb_value)
                tprintf("|%u<<MAP_HUGE_SHIFT",
diff --git a/xlat.c b/xlat.c
index 50025a69a778d5d6d374bd10c04ec38661128e90..be58f72eca1fcbb2e959b9496c6cdf70d8abc37c 100644 (file)
--- a/xlat.c
+++ b/xlat.c
@@ -139,24 +139,6 @@ printxval_searchn(const struct xlat *xlat, size_t xlat_size, uint64_t val,
        return 0;
 }
 
-/*
- * Interpret `xlat' as an array of flags
- * print the entries whose bits are on in `flags'
- */
-void
-addflags(const struct xlat *xlat, uint64_t flags)
-{
-       for (; xlat->str; xlat++) {
-               if (xlat->val && (flags & xlat->val) == xlat->val) {
-                       tprintf("|%s", xlat->str);
-                       flags &= ~xlat->val;
-               }
-       }
-       if (flags) {
-               tprintf("|%#" PRIx64, flags);
-       }
-}
-
 /*
  * Interpret `xlat' as an array of flags.
  * Print to static string the entries whose bits are on in `flags'