summaryrefslogtreecommitdiffstats
path: root/lib/system.h
diff options
context:
space:
mode:
authorAkihiko Odaki <[email protected]>2016-10-11 23:06:48 +0900
committerMark Wielaard <[email protected]>2016-10-12 15:43:14 +0200
commit60b2bf1b08c621492410b24e469b2bdf58d167d5 (patch)
tree9a9f16d5a686b42469c190a7d3b0bd245344dc48 /lib/system.h
parent7bf4b63a4980788e6c1969cae02f0483e79c069f (diff)
lib: Provide MAX and MIN in system.h
This change also creates a new header file libeu.h to provide the prototypes for the function of libeu. That hides the definition of function crc32, which can conflict with zlib, from libelf. It also prevents mistakes to refer those functions from a component which doesn't link with libeu, such as libelf. Signed-off-by: Akihiko Odaki <[email protected]>
Diffstat (limited to 'lib/system.h')
-rw-r--r--lib/system.h48
1 files changed, 7 insertions, 41 deletions
diff --git a/lib/system.h b/lib/system.h
index f31cfd03..ec387c31 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -32,6 +32,7 @@
#include <argp.h>
#include <stddef.h>
#include <stdint.h>
+#include <sys/param.h>
#include <endian.h>
#include <byteswap.h>
#include <unistd.h>
@@ -50,16 +51,14 @@
# error "Unknown byte order"
#endif
-extern void *xmalloc (size_t) __attribute__ ((__malloc__));
-extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
-extern void *xrealloc (void *, size_t) __attribute__ ((__malloc__));
-
-extern char *xstrdup (const char *) __attribute__ ((__malloc__));
-extern char *xstrndup (const char *, size_t) __attribute__ ((__malloc__));
+#ifndef MAX
+#define MAX(m, n) ((m) < (n) ? (n) : (m))
+#endif
+#ifndef MIN
+#define MIN(m, n) ((m) < (n) ? (m) : (n))
+#endif
-extern uint32_t crc32 (uint32_t crc, unsigned char *buf, size_t len);
-extern int crc32_file (int fd, uint32_t *resp);
/* A special gettext function we use if the strings are too short. */
#define sgettext(Str) \
@@ -142,39 +141,6 @@ pread_retry (int fd, void *buf, size_t len, off_t off)
extern char *__cxa_demangle (const char *mangled_name, char *output_buffer,
size_t *length, int *status);
-
-
-/* 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[];
-
/* A static assertion. This will cause a compile-time error if EXPR,
which must be a compile-time constant, is false. */