Re: svn commit: r1917082 - /apr/apr/trunk/buffer/apr_buffer.c

Yann Ylavic <[email protected]>
Newsgroups gmane.comp.apache.apr.devel
Message-ID <CAKQ1sVOaVDD1_F=pULRtjTaDL+UQS3_F=g69Ry0bSngJayreQA@mail.gmail.com>
On Thu, Apr 18, 2024 at 4:41 PM Yann Ylavic <[email protected]> wrote:
>
> could be:
> APR_DECLARE(apr_status_t) apr_buffer_str_set(apr_buffer_t *buf,
>                                              char *str, apr_size_t len)
> {
>     if (len == APR_BUFFER_STRING) {
>         len = str ? strlen(str) : 0;
>     }
>     if (len > APR_BUFFER_MAX) {
>         return APR_EINVAL;
>     }
>
>     if (!str) {
>         buf->d.str = NULL;
>         buf->size = 0;
>     }
>     else {
>         buf->d.str = str;
>         buf->size = len;
>     }
>     buf->size |= ~APR_BUFFER_MAX;

The above conditional is not even needed, just:
      buf->d.str = str;
      buf->size = len | ~APR_BUFFER_MAX;
works too.

>
>     return APR_SUCCESS;
> }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.