From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAN74-00087u-08 for qemu-devel@nongnu.org; Tue, 07 Jun 2016 15:56:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAN6z-0006kM-ML for qemu-devel@nongnu.org; Tue, 07 Jun 2016 15:56:33 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:52025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAN6z-0006kF-BC for qemu-devel@nongnu.org; Tue, 07 Jun 2016 15:56:29 -0400 References: <1465239499-5048-1-git-send-email-peter.maydell@linaro.org> <1465239499-5048-18-git-send-email-peter.maydell@linaro.org> From: Laurent Vivier Message-ID: Date: Tue, 7 Jun 2016 21:56:18 +0200 MIME-Version: 1.0 In-Reply-To: <1465239499-5048-18-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 17/18] linux-user: Make target_strerror() return 'const char *' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio Le 06/06/2016 à 20:58, Peter Maydell a écrit : > Make target_strerror() return 'const char *' rather than just 'char *'; > this will allow us to return constant strings from it for some special > cases. > > Signed-off-by: Peter Maydell Reviewed-by: Laurent Vivier > --- > linux-user/qemu.h | 2 +- > linux-user/strace.c | 4 ++-- > linux-user/syscall.c | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/linux-user/qemu.h b/linux-user/qemu.h > index 6bd7b32..56f29c3 100644 > --- a/linux-user/qemu.h > +++ b/linux-user/qemu.h > @@ -195,7 +195,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, > void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2); > extern THREAD CPUState *thread_cpu; > void cpu_loop(CPUArchState *env); > -char *target_strerror(int err); > +const char *target_strerror(int err); > int get_osversion(void); > void init_qemu_uname_release(void); > void fork_start(void); > diff --git a/linux-user/strace.c b/linux-user/strace.c > index 0810c85..c5980a1 100644 > --- a/linux-user/strace.c > +++ b/linux-user/strace.c > @@ -281,7 +281,7 @@ print_ipc(const struct syscallname *name, > static void > print_syscall_ret_addr(const struct syscallname *name, abi_long ret) > { > - char *errstr = NULL; > + const char *errstr = NULL; > > if (ret < 0) { > errstr = target_strerror(-ret); > @@ -1594,7 +1594,7 @@ void > print_syscall_ret(int num, abi_long ret) > { > int i; > - char *errstr = NULL; > + const char *errstr = NULL; > > for(i=0;i if( scnames[i].nr == num ) { > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index 249d246..bcee02d 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -617,7 +617,7 @@ static inline int is_error(abi_long ret) > return (abi_ulong)ret >= (abi_ulong)(-4096); > } > > -char *target_strerror(int err) > +const char *target_strerror(int err) > { > if ((err >= ERRNO_TABLE_SIZE) || (err < 0)) { > return NULL; >