signed vs. unsigned in plpy_procedure.c

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: signed vs. unsigned in plpy_procedure.c
Date: 2013-07-02 10:39:46
Message-ID: 20130702103946.GB25626@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

src/postgresql/src/pl/plpython/plpy_procedure.c: In function ‘PLy_procedure_munge_source’:
src/postgresql/src/pl/plpython/plpy_procedure.c:507:2: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
Assert(plen >= 0 && plen < mlen);

Which has a point, we assign sprintf()s result to a size_t and then
check for a negative value. Which doesn't work.

Obviously the impact is miniscule, but removing legitimate warnings is a
good thing. Trivial patch attached.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
plpy_procedure_unsigned.patch text/x-patch 433 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2013-07-02 11:05:36 Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist
Previous Message MauMau 2013-07-02 10:33:08 Re: pgsql_tmp and external sort