[GRASS-dev] G_squeeze()

Hi,

what's the reason why G_squeeze() return pointer to it's argument?

Thanks in advance, Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Martin Landa wrote:

what's the reason why G_squeeze() return pointer to it's argument?

It has been that way since at least 4.2.1. The comment there says:

   * returns the address of the resulting compressed string.

It may have once stripped leading whitespace by simply advancing the
pointer rather than moving the data.

As nothing in 7.0 uses the returned value, the return type should
probably be changed to void.

--
Glynn Clements <glynn@gclements.plus.com>

Hi,

2011/7/23 Glynn Clements <glynn@gclements.plus.com>:

what's the reason why G_squeeze() return pointer to it's argument?

It has been that way since at least 4.2.1. The comment there says:

    \* returns the address of the resulting compressed string\.

It may have once stripped leading whitespace by simply advancing the
pointer rather than moving the data.

As nothing in 7.0 uses the returned value, the return type should
probably be changed to void.

seems to be same with G_chop(), right?

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Martin Landa wrote:

seems to be same with G_chop(), right?

Right; the comment for G_chop() says:

* modified copy of G_squeeze(); RB March 2000 <Radim.Blazek@dhv.cz>

--
Glynn Clements <glynn@gclements.plus.com>

2011/7/23 Glynn Clements <glynn@gclements.plus.com>:

seems to be same with G_chop(), right?

Right; the comment for G_chop() says:

* modified copy of G_squeeze(); RB March 2000 <Radim.Blazek@dhv.cz>

done in r47408.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa