]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Move color handling into a separate header
authorUlf Hermann <ulf.hermann@qt.io>
Tue, 14 Feb 2017 13:30:47 +0000 (14:30 +0100)
committerMark Wielaard <mark@klomp.org>
Wed, 15 Feb 2017 14:24:24 +0000 (15:24 +0100)
We only need it in nm.c and objdump.c, but it pulls in argp as
dependency. By dropping it from libeu.h, the libraries can be
compiled without argp.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
lib/ChangeLog
lib/Makefile.am
lib/color.c
lib/color.h [new file with mode: 0644]
lib/libeu.h
src/ChangeLog
src/nm.c
src/objdump.c

index fcf5b10512754eb5f2f8a003b77860bca7ca19f1..5ccf4d6b556ca3aa8c60dc43d3c9a4bfb8773c6b 100644 (file)
@@ -1,3 +1,10 @@
+2017-02-14  Ulf Hermann  <ulf.hermann@qt.io>
+
+       * color.h: New file.
+       * color.c: Include color.h.
+       * libeu.h: Remove color handling.
+       * Makefile.am (noinst_HEADERS): Add color.h.
+
 2016-12-29  Luiz Angelo Daros de Luca  <luizluca@gmail.com>
 
        * crc32_file.c: Include system.h.
index 1ad9ce8fadc993b4eac3a6f515f4b5ef48ff4076..3e0c601fe28eafcb23c3a95008f2bcbb4d43374c 100644 (file)
@@ -38,7 +38,7 @@ libeu_a_SOURCES = xstrdup.c xstrndup.c xmalloc.c next_prime.c \
                  color.c version.c
 
 noinst_HEADERS = fixedsizehash.h libeu.h system.h dynamicsizehash.h list.h \
-                md5.h sha1.h eu-config.h
+                md5.h sha1.h eu-config.h color.h
 EXTRA_DIST = dynamicsizehash.c
 
 if !GPROF
index fde2d9de2ba3c6aea9ae41529a1cd200fd937509..f62389d5dac1cb3da01dfeee9d61dbdd060a1e85 100644 (file)
@@ -38,7 +38,7 @@
 #include <string.h>
 #include <unistd.h>
 #include "libeu.h"
-
+#include "color.h"
 
 /* Prototype for option handler.  */
 static error_t parse_opt (int key, char *arg, struct argp_state *state);
diff --git a/lib/color.h b/lib/color.h
new file mode 100644 (file)
index 0000000..3872eb0
--- /dev/null
@@ -0,0 +1,63 @@
+/* Handling of color output.
+   Copyright (C) 2017 The Qt Company
+   This file is part of elfutils.
+   Written by Ulrich Drepper <drepper@redhat.com>, 2011.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+
+#ifndef COLOR_H
+#define COLOR_H 1
+
+/* Command line parser.  */
+extern const struct argp color_argp;
+
+/* Coloring mode.  */
+enum color_enum
+  {
+    color_never = 0,
+    color_always,
+    color_auto
+  } __attribute__ ((packed));
+extern enum color_enum color_mode;
+
+/* Colors to use for the various components.  */
+extern char *color_address;
+extern char *color_bytes;
+extern char *color_mnemonic;
+extern char *color_operand1;
+extern char *color_operand2;
+extern char *color_operand3;
+extern char *color_label;
+extern char *color_undef;
+extern char *color_undef_tls;
+extern char *color_undef_weak;
+extern char *color_symbol;
+extern char *color_tls;
+extern char *color_weak;
+
+extern const char color_off[];
+
+#endif /* color.h */
index 69fe3d7f370151da2e839e96f25c0488003c6460..ecb4d01107e0d797848050cfb1722435f5097243 100644 (file)
@@ -43,36 +43,4 @@ extern char *xstrndup (const char *, size_t) __attribute__ ((__malloc__));
 extern uint32_t crc32 (uint32_t crc, unsigned char *buf, size_t len);
 extern int crc32_file (int fd, uint32_t *resp);
 
-
-/* Color handling.  */
-
-/* Command line parser.  */
-extern const struct argp color_argp;
-
-/* Coloring mode.  */
-enum color_enum
-  {
-    color_never = 0,
-    color_always,
-    color_auto
-  } __attribute__ ((packed));
-extern enum color_enum color_mode;
-
-/* Colors to use for the various components.  */
-extern char *color_address;
-extern char *color_bytes;
-extern char *color_mnemonic;
-extern char *color_operand1;
-extern char *color_operand2;
-extern char *color_operand3;
-extern char *color_label;
-extern char *color_undef;
-extern char *color_undef_tls;
-extern char *color_undef_weak;
-extern char *color_symbol;
-extern char *color_tls;
-extern char *color_weak;
-
-extern const char color_off[];
-
 #endif
index 2a6d93ef8c0356b39f1bd25938ddc054030263e2..19c7dbb7ded2189842ec5ee7aec70be5244a40b6 100644 (file)
@@ -1,3 +1,8 @@
+2017-02-14  Ulf Hermann  <ulf.hermann@qt.io>
+
+       * nm.c: Include color.h.
+       * objdump.c: Likewise.
+
 2016-12-24  Mark Wielaard  <mark@klomp.org>
 
        * Makefile.am (findtextrel_LDADD): Add $(libeu).
index c54e96f01ea97aa639a1ffabe1df3fd75f9d800a..47a9e3b176303741eaba886bc41333f6ec9fefa6 100644 (file)
--- a/src/nm.c
+++ b/src/nm.c
@@ -44,6 +44,7 @@
 
 #include <libeu.h>
 #include <system.h>
+#include <color.h>
 #include "../libebl/libeblP.h"
 #include "../libdwfl/libdwflP.h"
 
index fff4b818521fcc309a11a7ef89dea17ac0b69a0f..030274bc19bf5f3f955d2b9c13bbe0d3a7bbc66e 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <libeu.h>
 #include <system.h>
+#include <color.h>
 #include "../libebl/libeblP.h"