Обсуждение: pgsql-server: Add missing null terminator to escaped string; clean up

Поиск
Список
Период
Сортировка

pgsql-server: Add missing null terminator to escaped string; clean up

От
tgl@svr1.postgresql.org (Tom Lane)
Дата:
Log Message:
-----------
Add missing null terminator to escaped string; clean up unnecessarily
obscurantist coding conventions.

Modified Files:
--------------
    pgsql-server/src/bin/initdb:
        initdb.c (r1.58 -> r1.59)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/initdb/initdb.c.diff?r1=1.58&r2=1.59)

Re: pgsql-server: Add missing null terminator to escaped

От
Bruce Momjian
Дата:
Thanks.  Wonder why my testing worked?  I guess xmalloc was giving me
zeroed memory.

---------------------------------------------------------------------------

Tom Lane wrote:
> Log Message:
> -----------
> Add missing null terminator to escaped string; clean up unnecessarily
> obscurantist coding conventions.
>
> Modified Files:
> --------------
>     pgsql-server/src/bin/initdb:
>         initdb.c (r1.58 -> r1.59)
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/initdb/initdb.c.diff?r1=1.58&r2=1.59)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: pgsql-server: Add missing null terminator to escaped

От
Tom Lane
Дата:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Thanks.  Wonder why my testing worked?  I guess xmalloc was giving me
> zeroed memory.

One-shot programs like initdb are very likely to see all-zeroed memory,
since that's what the kernel gives you.  It's only after you start
freeing things that you'll get nonzero areas from malloc ...

            regards, tom lane