[Patch] don't ignore return of g_list_append

Hi,

Some code in rbglib_completion ignores the return value of
g_list_append,
this might cause problems as the start of the list can move around.
Attached
trivial patch fixes this.

Sjoerd

Hi,

On Tue, 9 May 2006 11:06:54 +0200
[email protected] (Sjoerd S.) wrote:

Hi,

Some code in rbglib_completion ignores the return value of g_list_append,
this might cause problems as the start of the list can move around. Attached
trivial patch fixes this.

Could you show me a sample to explain this problem?


.:% Masao M.[email protected]


Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

On Wed, May 10, 2006 at 02:35:46AM +0900, Masao M. wrote:

Hi,

On Tue, 9 May 2006 11:06:54 +0200
[email protected] (Sjoerd S.) wrote:

Some code in rbglib_completion ignores the return value of g_list_append,
this might cause problems as the start of the list can move around.
Attached trivial patch fixes this.

Could you show me a sample to explain this problem?

Sure. But while creating the example i noticed there was more wrong then
the
little (common) error i spotted initially. I’ve also added some
Check_Type
calls to ensure the parameters are actually arrays. Updated patch
attached.

For an example:
require ‘glib2’

c = GLib::Completion.new

c.add_items([“One”, “Two”, “Three”])
p c.items.keys
c.remove_items([“Two”, “One”])
p c.items.keys

p c.complete("")

Without the patch it outputs:
[“Two”, “One”, “Three”]
[“One”, “Three”]
[[“Three”, “Two”, “One”], nil]

With the patch it gives the correct output:
[“Two”, “One”, “Three”]
[“Three”]
[[“Three”], nil]

Sjoerd