Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libc/stdio



> Index: src/lib/libc/stdio/fmemopen.c
> diff -u src/lib/libc/stdio/fmemopen.c:1.3 src/lib/libc/stdio/fmemopen.c:1.4
> --- src/lib/libc/stdio/fmemopen.c:1.3 Sat Sep 25 14:00:30 2010
> +++ src/lib/libc/stdio/fmemopen.c     Mon Sep 27 16:50:13 2010
> @@ -79,16 +79,18 @@
>       if (p->cur >= p->tail)
>               return 0;
>       s = p->cur;
> -     t = p->tail - 1;
>       do {
> -             if (p->cur == t) {
> -                     if (*buf == '\0')
> -                             *p->cur++ = *buf++;
> +             if (p->cur == p->tail - 1) {
> +                     if (*buf == '\0') {
> +                             *p->cur++ = '\0';
> +                             goto ok;
> +                     }
>                       break;
>               }
>               *p->cur++ = *buf++;
>       } while (--nbytes > 0);
>       *p->cur = '\0';
> +ok:
>       if (p->cur > p->eob)
>               p->eob = p->cur;
>  
> 

Do we have any reason to NOT use more assertions in such a critical
library code path?

Masao

-- 
Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635


Home | Main Index | Thread Index | Old Index