Re: POC: make mxidoff 64 bits

Поиск
Список
Период
Сортировка
От zengman
Тема Re: POC: make mxidoff 64 bits
Дата
Msg-id tencent_566562B52163DB1502F4F7A4@qq.com
обсуждение исходный текст
Ответ на Re: POC: make mxidoff 64 bits  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-hackers
Hi,

I'm currently looking into the `SlruReadSwitchPageSlow` function and have a question regarding the expression
`&state->buf.data+ bytes_read` — 
 
I suspect the ampersand (&) here might be misused. Would you be able to help me verify this?

```
    while (bytes_read < BLCKSZ)
    {
        ssize_t        rc;

        rc = pg_pread(state->fd,
                      &state->buf.data + bytes_read,
                      BLCKSZ - bytes_read,
                      offset);
        if (rc < 0)
        {
            if (errno == EINTR)
                continue;
            pg_fatal("could not read file \"%s\": %m", state->fn);
        }
        if (rc == 0)
        {
            /* unexpected EOF */
            pg_log(PG_WARNING, "unexpected EOF reading file \"%s\" at offset %u, reading as zeros",
                   state->fn, (unsigned int) offset);
            memset(&state->buf.data + bytes_read, 0, BLCKSZ - bytes_read);
            break;
        }
        bytes_read += rc;
        offset += rc;
    }
```

```
        rc = pg_pread(state->fd,
                      &state->buf.data + bytes_read,
                      BLCKSZ - bytes_read,
                      offset);
memset(&state->buf.data + bytes_read, 0, BLCKSZ - bytes_read);
```

--
Regards,
Man Zeng
www.openhalo.org
Вложения

В списке pgsql-hackers по дате отправления: