From: Ulf Hermann Date: Tue, 14 Feb 2017 13:30:47 +0000 (+0100) Subject: Move color handling into a separate header X-Git-Tag: elfutils-0.169~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29173849c445b178a97e400c071f25629a4f8b9f;p=thirdparty%2Felfutils.git 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 --- diff --git a/lib/ChangeLog b/lib/ChangeLog index fcf5b1051..5ccf4d6b5 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,10 @@ +2017-02-14 Ulf Hermann + + * 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 * crc32_file.c: Include system.h. diff --git a/lib/Makefile.am b/lib/Makefile.am index 1ad9ce8fa..3e0c601fe 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 fde2d9de2..f62389d5d 100644 --- a/lib/color.c +++ b/lib/color.c @@ -38,7 +38,7 @@ #include #include #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 000000000..3872eb0ac --- /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 , 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 . */ + + +#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 69fe3d7f3..ecb4d0110 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 diff --git a/src/ChangeLog b/src/ChangeLog index 2a6d93ef8..19c7dbb7d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2017-02-14 Ulf Hermann + + * nm.c: Include color.h. + * objdump.c: Likewise. + 2016-12-24 Mark Wielaard * Makefile.am (findtextrel_LDADD): Add $(libeu). diff --git a/src/nm.c b/src/nm.c index c54e96f01..47a9e3b17 100644 --- a/src/nm.c +++ b/src/nm.c @@ -44,6 +44,7 @@ #include #include +#include #include "../libebl/libeblP.h" #include "../libdwfl/libdwflP.h" diff --git a/src/objdump.c b/src/objdump.c index fff4b8185..030274bc1 100644 --- a/src/objdump.c +++ b/src/objdump.c @@ -35,6 +35,7 @@ #include #include +#include #include "../libebl/libeblP.h"