Re: libpq: PQcmdStatus, PQcmdTuples signatures can be painlessly improved
| От | Peter Eisentraut |
|---|---|
| Тема | Re: libpq: PQcmdStatus, PQcmdTuples signatures can be painlessly improved |
| Дата | |
| Msg-id | 1326215622.22414.2.camel@vanquo.pezone.net обсуждение исходный текст |
| Ответ на | libpq: PQcmdStatus, PQcmdTuples signatures can be painlessly improved (Alex Goncharov <alex-goncharov@comcast.net>) |
| Ответы |
Re: libpq: PQcmdStatus, PQcmdTuples signatures can be
painlessly improved
|
| Список | pgsql-hackers |
On tis, 2011-12-13 at 07:55 -0500, Alex Goncharov wrote: > char *PQcmdStatus(PGresult *res); > char *PQcmdTuples(PGresult *res); > > Unreasonable: > > a. What, these two can modify 'res' I pass in?.. > > b. Oh, yes, because they return 'char *' pointing to > 'res->cmdStatus+n', so, a libpq user may write: > > char *s = PQcmdStatus(res); > *s = 'x'; > > and have 'res' modified. (Would be the user's fault, of course.) > Note that const PGresult * would only warn against changing the fields of the PGresult struct. It doesn't do anything about changing the data pointed to by pointers in the PGresult struct. So what you are saying doesn't follow.
В списке pgsql-hackers по дате отправления: