<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body ><div>Actually I haven't thought about it properly. As you say 0 for success is a bad idea since it doesn't match LW_SUCCESS.</div><div>So it should be LW_SUCCESS or void. What do you think?</div><div>Sorry for leaving it un finnished.</div><div>/Nicklas</div><div><br></div><div><br></div><div><div style="font-size:9px;color:#575757">Skickat från min Samsung Mobil.</div></div><br><br><div>-------- Originalmeddelande --------</div><div>Från: Sandro Santilli <strk@keybit.net> </div><div>Datum:2014-08-27 16:10 (GMT+01:00) </div><div>Till: PostGIS Development Discussion <postgis-devel@lists.osgeo.org> </div><div>Kopia: Nicklas Avén <nicklas.aven@jordogskog.no> </div><div>Rubrik: Re: [postgis-devel] breaking changes in varInt code and twkb </div><div><br></div>On Sat, Aug 23, 2014 at 07:24:09AM +0200, Sandro Santilli wrote:<br>> On Sat, Aug 23, 2014 at 12:03:11AM +0200, Nicklas Avén wrote:<br>> > Sandro<br>> > <br>> > in r12907 I did the switch to passing around **buf instead of *buf in<br>> > twkb and varint. That affects all the varInt types. I don't think you<br>> > have committed any code relying on varInt yet though. Right?<br>> <br>> Not in trunk, but I have it in a fork:<br>> https://github.com/strk/postgis/blob/mvt/liblwgeom/lwout_vt.c<br><br>Nicklas, I'm rebasing my branch against trunk now and hitting that interface<br>change of varint encoder taking **buf instead of *buf.<br>You made those functions return an integer, but they all return 0<br>unconditionally. Should they be returning void ?<br><br>> > I couldn't see any performance difference, but it gets a little cleaner<br>> > and is the first step to clean up more in all the values thrown around<br>> > in the twkb code.<br><br>My code looked like this:<br><br> /* encode X parameter */<br> to = varint_s32_encode_buf(dc->x, to);<br> /* encode Y parameter */<br> to = varint_s32_encode_buf(dc->y, to);<br><br>To adapt to your change it would need to be converted to this:<br><br> /* encode X parameter */<br> if ( varint_s32_encode_buf(dc->x, &to) ) { lwerror(...); return; }<br> /* encode Y parameter */<br> if ( varint_s32_encode_buf(dc->y, &to) ) { lwerror(...); return; }<br><br>Is that the idea ?<br>Note that liblwgeom.h defines LW_SUCCESS as 1 and LW_FAILURE as 0. <br>I know it doesn't allow to return different kind of errors, but that's<br>what we have right now used elsewere.<br><br>In what circumstance could those functions return an error ?<br><br>--strk; <br><br> () ASCII ribbon campaign -- Keep it simple !<br> /\ http://strk.keybit.net/rants/ascii_mails.txt <br><br></body>