]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: tools: make resolve_sym_name() return a const
authorWilly Tarreau <w@1wt.eu>
Sun, 5 Jul 2020 18:26:04 +0000 (20:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 5 Jul 2020 18:26:04 +0000 (20:26 +0200)
Originally it was made to return a void* because some comparisons in the
code where it was used required a lot of casts. But now we don't need
that anymore. And having it non-const breaks the build on NetBSD 9 as
reported in issue #728.

So let's switch to const and adjust debug.c to accomodate this.

include/haproxy/tools.h
src/debug.c
src/tools.c

index 2b003e4186d68afa6ac5ef9d8ee49c7d9eb35bd0..0cf605352823133de2991616f9b0a6384cdadfb8 100644 (file)
@@ -996,7 +996,7 @@ int dump_text_line(struct buffer *out, const char *buf, int bsize, int len,
 void dump_addr_and_bytes(struct buffer *buf, const char *pfx, const void *addr, int n);
 void dump_hex(struct buffer *out, const char *pfx, const void *buf, int len, int unsafe);
 int may_access(const void *ptr);
-void *resolve_sym_name(struct buffer *buf, const char *pfx, void *addr);
+const void *resolve_sym_name(struct buffer *buf, const char *pfx, void *addr);
 const char *get_exec_path();
 
 #if defined(USE_BACKTRACE)
index e1a07f0a68c5a648d1bde83921e126941fe7d8bf..e173f4277cd9eb5b5c3c38c50b5446f696723884 100644 (file)
@@ -98,7 +98,7 @@ void ha_thread_dump(struct buffer *buf, int thr, int calling_tid)
                struct buffer bak;
                void *callers[100];
                int j, nptrs;
-               void *addr;
+               const void *addr;
                int dump = 0;
 
                nptrs = my_backtrace(callers, sizeof(callers)/sizeof(*callers));
index fa92db58b90119a7f3e7b44d78049082e08f4097..39a4538bcd68afdcbec248900700d525bdf7eca1 100644 (file)
@@ -4426,7 +4426,7 @@ static int dladdr_and_size(const void *addr, Dl_info *dli, size_t *size)
  * The symbol's base address is returned, or NULL when unresolved, in order to
  * allow the caller to match it against known ones.
  */
-void *resolve_sym_name(struct buffer *buf, const char *pfx, void *addr)
+const void *resolve_sym_name(struct buffer *buf, const char *pfx, void *addr)
 {
        const struct {
                const void *func;