neovim/neovim — pull request #726 by simula67 (2014-05-16 14:44:13+00:00)
Title: Avoid redundant pointer copy

Not sure what the intention here is, but if it is not to modify the passed in parameter, the pointer itself is passed by value.

Note that the code below ( for example skiptowhite ) is aware of this.

I also tested this with a small file, please find the following terminal output :

simula67@hades ~/scratch » cat test.c
#include

char * change_str( char *inp_str )
{
++inp_str;
return inp_str;
}
int main()
{
char *inp_str = "Hello world";
char *changed = change_str(inp_str);
printf("%s\n", inp_str);
printf("%s\n", changed);
return 0;
}
simula67@hades ~/scratch » cc test.c -o test
simula67@hades ~/scratch » ./test
Hello world
ello world