From: | "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com> |
---|---|
To: | 'Kyotaro Horiguchi' <horikyota(dot)ntt(at)gmail(dot)com>, "alvherre(at)alvh(dot)no-ip(dot)org" <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | "iwata(dot)aya(at)fujitsu(dot)com" <iwata(dot)aya(at)fujitsu(dot)com>, "tgl(at)sss(dot)pgh(dot)pa(dot)us" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "k(dot)jamison(at)fujitsu(dot)com" <k(dot)jamison(at)fujitsu(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | RE: libpq debug log |
Date: | 2021-03-11 03:01:16 |
Message-ID: | TYAPR01MB2990A809259CF4973B1942C9FE909@TYAPR01MB2990.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
> The output functions copy message bytes into local variable but the
> same effect can be obtained by just casing via typed pointer type.
>
> uint32 tmp4;
> ..
> memcpy(&tmp4, buf + *cursor, 4);
> result = (int) pg_ntoh32(tmp4);
>
> can be written as
>
> result = pg_ntoh32(* (uint32 *) (buf + *cursor));
I'm afraid we need to memcpy() because of memory alignment.
> I think we can get rid of copying in the output functions for String
> and Bytes in different ways.
I haven't looked at this code, but you sound right.
Regards
Takayuki Tsunakawa
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro Horiguchi | 2021-03-11 03:02:40 | Re: libpq debug log |
Previous Message | Thomas Munro | 2021-03-11 02:54:06 | Re: Replace buffer I/O locks with condition variables (reviving an old patch) |