summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-02-14 14:30:47 +0100
committerMark Wielaard <mark@klomp.org>2017-02-15 15:24:24 +0100
commit29173849c445b178a97e400c071f25629a4f8b9f (patch)
tree09f5b93a1e221904104fe6e342268ca18e36dba2 /lib
parent01b994e3e6ccb8e79d04a8f6fd10719fac8ff5b8 (diff)
Move color handling into a separate header
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/ChangeLog7
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/color.c2
-rw-r--r--lib/color.h63
-rw-r--r--lib/libeu.h32
5 files changed, 72 insertions, 34 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index fcf5b105..5ccf4d6b 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -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.
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 1ad9ce8f..3e0c601f 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -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
diff --git a/lib/color.c b/lib/color.c
index fde2d9de..f62389d5 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -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
index 00000000..3872eb0a
--- /dev/null
+++ b/lib/color.h
@@ -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 */
diff --git a/lib/libeu.h b/lib/libeu.h
index 69fe3d7f..ecb4d011 100644
--- a/lib/libeu.h
+++ b/lib/libeu.h
@@ -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