diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2010-11-30 21:07:55 -0200 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2010-11-30 21:07:55 -0200 |
commit | cd504e49bcece187dee85b33e39f72b5eab53cda (patch) | |
tree | 3a6628be68aeed877ea2ab4505d3f24bc1b62185 /mysys | |
parent | d5e928959e55b4c124a783b83c2c70069dbedbca (diff) | |
download | mariadb-git-cd504e49bcece187dee85b33e39f72b5eab53cda.tar.gz |
Workaround a GCC warning about a pointer being cast to a larger
integral type. Use intptr which is designed to hold pointer values
and pass it to off_t.
mysys/stacktrace.c:
Add a compile time assert to ensure that off_t is large enough
to hold the pointer value.
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/stacktrace.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index b6bf88cf3e1..93e8ae6b508 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -87,8 +87,11 @@ static int safe_print_str(const char *addr, int max_len) if ((fd= open(buf, O_RDONLY)) < 0) return -1; + /* Ensure that off_t can hold a pointer. */ + compile_time_assert(sizeof(off_t) >= sizeof(intptr)); + total= max_len; - offset= (off_t) addr; + offset= (intptr) addr; /* Read up to the maximum number of bytes. */ while (total) |