[patch 2/4] Code cleanup: Remove const in prototype

Mark Wielaard mjw at redhat.com
Thu Nov 14 19:19:32 UTC 2013


On Sun, 2013-11-10 at 21:21 +0100, Jan Kratochvil wrote:
> cv-qualifier in declaration has no effect on callers but the parameter needs
> to be modified in function implementation in [patch 3/4].  To keep the code
> consistent I have removed it everywhere.
>
> Code cleanup: Remove const in prototype
> 
> libdwfl/
> 2013-11-10  Jan Kratochvil  <jan.kratochvil at redhat.com>
> 
> 	Code cleanup: Remove const in prototype
> 	* dwfl_frame_regs.c (dwfl_thread_state_registers): Remove const from
> 	firstreg.
> 	* libdwfl.h (dwfl_thread_state_registers): Likewise.
> 	* linux-pid-attach.c (pid_thread_state_registers_cb): Likewise.
> 
> libebl/
> 2013-11-10  Jan Kratochvil  <jan.kratochvil at redhat.com>
> 
> 	Code cleanup: Remove const in prototype
> 	* libebl.h (ebl_tid_registers_t): Remove const from firstreg.

I think removing the const is harmless like you said. A const int is
passed by value, so is only a hint to the caller. But I am surprised you
need this. We does the parameter need to be modified? Can't you just
pass firstreg + 1 or first assign to a local var before passing the
(const) int around?

Cheers,

Mark



More information about the elfutils-devel mailing list