This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3] ari, btrace: avoid unsigned long long


On 07/13/2015 03:47 PM, Markus Metzger wrote:

> diff --git a/gdb/common/btrace-common.c b/gdb/common/btrace-common.c
> index 95193eb..9d6c4a7 100644
> --- a/gdb/common/btrace-common.c
> +++ b/gdb/common/btrace-common.c
> @@ -155,10 +155,10 @@ btrace_data_append (struct btrace_data *dst,
>  	  dst->variant.pt.size = 0;
>  
>  	  /* fall-through.  */
> -	case BTRACE_FORMAT_BTS:
> +	case BTRACE_FORMAT_PT:

Looks like an unrelated change that should be pushed separately.

>  	  {
>  	    gdb_byte *data;
> -	    unsigned long size;
> +	    size_t size;
>  



>    tinfo = xzalloc (sizeof (*tinfo));
> @@ -674,28 +676,36 @@ linux_enable_bts (ptid_t ptid, const struct btrace_config_bts *conf)
>      goto err_out;
>  
>    /* Convert the requested size in bytes to pages (rounding up).  */
> -  pages = (((unsigned long long) conf->size) + PAGE_SIZE - 1) / PAGE_SIZE;
> +  pages = (size_t) conf->size / PAGE_SIZE
> +    + ((conf->size % PAGE_SIZE) == 0 ? 0 : 1);

Per, http://www.gnu.org/prep/standards/standards.html#Formatting
wrap with ()s so that the second line aligns correctly:

  pages = ((size_t) conf->size / PAGE_SIZE
	   + ((conf->size % PAGE_SIZE) == 0 ? 0 : 1));

>    /* Convert the requested size in bytes to pages (rounding up).  */
> -  pages = (((unsigned long long) conf->size) + PAGE_SIZE - 1) / PAGE_SIZE;
> +  pages = (size_t) conf->size / PAGE_SIZE
> +    + ((conf->size % PAGE_SIZE) == 0 ? 0 : 1);

Likewise.

Otherwise looks good to me.

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]