Re: [PATCH] libtraceeval: Fix comparing unsigned against zero

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

 



On Mon, 2 Oct 2023 12:31:02 -0600
Ross Zwisler <zwisler@xxxxxxxxxx> wrote:

> > @@ -303,14 +303,14 @@ struct traceeval *traceeval_init(struct traceeval_type *keys,
> >  
> >  	/* alloc key types */
> >  	teval->nr_key_types = type_alloc(keys, &teval->key_types);
> > -	if (teval->nr_key_types <= 0) {
> > +	if ((ssize_t)teval->nr_key_types <= 0) {  
> 
> Rather than casting, wouldn't it be better to just change the type of
> nr_key_types and nr_val_types to ssize_t?  I think this should be the return
> type of type_alloc() as well, since this returns -1 on error.

I thought about that, and there was a reason against it. But I forgot what
that was :-p

-- Steve




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux