bug-global
[Top][All Lists]
Advanced

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

Re: gtags cannot generate more than 2G files


From: Punit Agrawal
Subject: Re: gtags cannot generate more than 2G files
Date: Wed, 27 Sep 2017 22:34:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hi Iwamoto-san,

A couple of comments on the patch inline.

Hideki IWAMOTO <address@hidden> writes:

> Index: configure.ac
> ===================================================================
> RCS file: /sources/global/global/configure.ac,v
> retrieving revision 1.195
> diff -u -p -r1.195 configure.ac
> --- configure.ac      15 May 2017 06:15:00 -0000      1.195
> +++ configure.ac      27 Sep 2017 13:34:53 -0000
> @@ -115,6 +115,8 @@ AC_CHECK_SIZEOF(char)
>  if test ${ac_cv_sizeof_char} != 1; then
>       AC_MSG_ERROR([Char size isn't 8 bit.])
>  fi
> +AC_CHECK_SIZEOF(long)
> +AC_CHECK_SIZEOF(off_t)

I think this hunk isn't needed. More below...

>  
>  dnl Checks for library functions.
>  AC_FUNC_ALLOCA
> Index: libdb/mpool.c
> ===================================================================
> RCS file: /sources/global/global/libdb/mpool.c,v
> retrieving revision 1.8
> diff -u -p -r1.8 mpool.c
> --- libdb/mpool.c     13 Oct 2012 07:01:21 -0000      1.8
> +++ libdb/mpool.c     27 Sep 2017 13:34:53 -0000
> @@ -229,7 +229,11 @@ mpool_get(mp, pgno, flags)
>  #ifdef STATISTICS
>       ++mp->pageread;
>  #endif
> +#if SIZEOF_OFF_T > SIZEOF_LONG
> +     off = (off_t)mp->pagesize * (off_t)pgno;

There is no need to cast both the operands. Casting any one of the
operands is sufficient to promote the other.

Also, it would be helpful to have a comment explaining the reason for
the cast.

> +#else
>       off = mp->pagesize * pgno;
> +#endif

I think you can drop the #if checks and always cast unconditionally. It
is redundant if the sizeof(long) == sizeof(off_t) but it get's rid of
the #if..#else..#endif block.

It also removes the need for the configure.ac hunk above.

>  #ifdef HAVE_PREAD
>       if ((nr = pread(mp->fd, bp->page, mp->pagesize, off)) != mp->pagesize) {
>               if (nr >= 0)
> @@ -425,7 +429,11 @@ mpool_write(mp, bp)
>       if (mp->pgout)
>               (mp->pgout)(mp->pgcookie, bp->pgno, bp->page);
>  
> +#if SIZEOF_OFF_T > SIZEOF_LONG
> +     off = (off_t)mp->pagesize * (off_t)bp->pgno;
> +#else
>       off = mp->pagesize * bp->pgno;
> +#endif

Same comment as above.

Thanks,
Punit

>  #ifdef HAVE_PWRITE
>       if (pwrite(mp->fd, bp->page, mp->pagesize, off) != mp->pagesize)
>               return (RET_ERROR);
>
> _______________________________________________
> Bug-global mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/bug-global



reply via email to

[Prev in Thread] Current Thread [Next in Thread]