diff mbox

use bool for logical test functions

Message ID 1404836412-48238-1-git-send-email-mike.holmes@linaro.org
State Rejected
Headers show

Commit Message

Mike Holmes July 8, 2014, 4:20 p.m. UTC
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 include/odp_buffer.h                    | 2 +-
 include/odp_coremask.h                  | 2 +-
 include/odp_ticketlock.h                | 2 +-
 platform/linux-generic/odp_buffer.c     | 2 +-
 platform/linux-generic/odp_coremask.c   | 2 +-
 platform/linux-generic/odp_ticketlock.c | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

Comments

Taras Kondratiuk July 8, 2014, 4:26 p.m. UTC | #1
On 07/08/2014 07:20 PM, Mike Holmes wrote:
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>   include/odp_buffer.h                    | 2 +-
>   include/odp_coremask.h                  | 2 +-
>   include/odp_ticketlock.h                | 2 +-
>   platform/linux-generic/odp_buffer.c     | 2 +-
>   platform/linux-generic/odp_coremask.c   | 2 +-
>   platform/linux-generic/odp_ticketlock.c | 2 +-
>   6 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/include/odp_buffer.h b/include/odp_buffer.h
> index d8577fd..0a308b0 100644
> --- a/include/odp_buffer.h
> +++ b/include/odp_buffer.h
> @@ -73,7 +73,7 @@ int odp_buffer_type(odp_buffer_t buf);
>    *
>    * @return 1 if valid, otherwise 0

Does it make sense to change comments also

@return true if valid, otherwise false

>    */
> -int odp_buffer_is_valid(odp_buffer_t buf);
> +bool odp_buffer_is_valid(odp_buffer_t buf);
>
Bill Fischofer July 8, 2014, 4:29 p.m. UTC | #2
I agree.  If we're going to use bool, it should be true/false, not 1/0
(even though that's how true/false is implemented).

Bill


On Tue, Jul 8, 2014 at 11:26 AM, Taras Kondratiuk <
taras.kondratiuk@linaro.org> wrote:

> On 07/08/2014 07:20 PM, Mike Holmes wrote:
>
>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>> ---
>>   include/odp_buffer.h                    | 2 +-
>>   include/odp_coremask.h                  | 2 +-
>>   include/odp_ticketlock.h                | 2 +-
>>   platform/linux-generic/odp_buffer.c     | 2 +-
>>   platform/linux-generic/odp_coremask.c   | 2 +-
>>   platform/linux-generic/odp_ticketlock.c | 2 +-
>>   6 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/include/odp_buffer.h b/include/odp_buffer.h
>> index d8577fd..0a308b0 100644
>> --- a/include/odp_buffer.h
>> +++ b/include/odp_buffer.h
>> @@ -73,7 +73,7 @@ int odp_buffer_type(odp_buffer_t buf);
>>    *
>>    * @return 1 if valid, otherwise 0
>>
>
> Does it make sense to change comments also
>
> @return true if valid, otherwise false
>
>
>     */
>> -int odp_buffer_is_valid(odp_buffer_t buf);
>> +bool odp_buffer_is_valid(odp_buffer_t buf);
>>
>>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Mike Holmes July 8, 2014, 4:31 p.m. UTC | #3
Sounds good v2 on the way.


On 8 July 2014 12:29, Bill Fischofer <bill.fischofer@linaro.org> wrote:

> I agree.  If we're going to use bool, it should be true/false, not 1/0
> (even though that's how true/false is implemented).
>
> Bill
>
>
> On Tue, Jul 8, 2014 at 11:26 AM, Taras Kondratiuk <
> taras.kondratiuk@linaro.org> wrote:
>
>> On 07/08/2014 07:20 PM, Mike Holmes wrote:
>>
>>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>>> ---
>>>   include/odp_buffer.h                    | 2 +-
>>>   include/odp_coremask.h                  | 2 +-
>>>   include/odp_ticketlock.h                | 2 +-
>>>   platform/linux-generic/odp_buffer.c     | 2 +-
>>>   platform/linux-generic/odp_coremask.c   | 2 +-
>>>   platform/linux-generic/odp_ticketlock.c | 2 +-
>>>   6 files changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/include/odp_buffer.h b/include/odp_buffer.h
>>> index d8577fd..0a308b0 100644
>>> --- a/include/odp_buffer.h
>>> +++ b/include/odp_buffer.h
>>> @@ -73,7 +73,7 @@ int odp_buffer_type(odp_buffer_t buf);
>>>    *
>>>    * @return 1 if valid, otherwise 0
>>>
>>
>> Does it make sense to change comments also
>>
>> @return true if valid, otherwise false
>>
>>
>>     */
>>> -int odp_buffer_is_valid(odp_buffer_t buf);
>>> +bool odp_buffer_is_valid(odp_buffer_t buf);
>>>
>>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
diff mbox

Patch

diff --git a/include/odp_buffer.h b/include/odp_buffer.h
index d8577fd..0a308b0 100644
--- a/include/odp_buffer.h
+++ b/include/odp_buffer.h
@@ -73,7 +73,7 @@  int odp_buffer_type(odp_buffer_t buf);
  *
  * @return 1 if valid, otherwise 0
  */
-int odp_buffer_is_valid(odp_buffer_t buf);
+bool odp_buffer_is_valid(odp_buffer_t buf);
 
 /**
  * Print buffer metadata to STDOUT
diff --git a/include/odp_coremask.h b/include/odp_coremask.h
index 141cb6a..7eca868 100644
--- a/include/odp_coremask.h
+++ b/include/odp_coremask.h
@@ -111,7 +111,7 @@  void odp_coremask_clr(int core, odp_coremask_t *mask);
  * @param mask  Core mask to check if core num set or not
  * @return      non-zero if set otherwise 0
  */
-int odp_coremask_isset(int core, const odp_coremask_t *mask);
+bool odp_coremask_isset(int core, const odp_coremask_t *mask);
 
 /**
  * Count number of cores in mask
diff --git a/include/odp_ticketlock.h b/include/odp_ticketlock.h
index 6277a18..4d41fe2 100644
--- a/include/odp_ticketlock.h
+++ b/include/odp_ticketlock.h
@@ -73,7 +73,7 @@  void odp_ticketlock_unlock(odp_ticketlock_t *ticketlock);
  *
  * @return 1 if the lock is locked, otherwise 0.
  */
-int odp_ticketlock_is_locked(odp_ticketlock_t *ticketlock);
+bool odp_ticketlock_is_locked(odp_ticketlock_t *ticketlock);
 
 
 #ifdef __cplusplus
diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-generic/odp_buffer.c
index 0169eec..41b6a4c 100644
--- a/platform/linux-generic/odp_buffer.c
+++ b/platform/linux-generic/odp_buffer.c
@@ -36,7 +36,7 @@  int odp_buffer_type(odp_buffer_t buf)
 }
 
 
-int odp_buffer_is_valid(odp_buffer_t buf)
+bool odp_buffer_is_valid(odp_buffer_t buf)
 {
 	odp_buffer_bits_t handle;
 
diff --git a/platform/linux-generic/odp_coremask.c b/platform/linux-generic/odp_coremask.c
index c55eb72..c98a10a 100644
--- a/platform/linux-generic/odp_coremask.c
+++ b/platform/linux-generic/odp_coremask.c
@@ -81,7 +81,7 @@  void odp_coremask_clr(int core, odp_coremask_t *mask)
 }
 
 
-int odp_coremask_isset(int core, const odp_coremask_t *mask)
+bool odp_coremask_isset(int core, const odp_coremask_t *mask)
 {
 	/* should not be more than 63
 	 * core no. should be from 0..63= 64bit
diff --git a/platform/linux-generic/odp_ticketlock.c b/platform/linux-generic/odp_ticketlock.c
index be5b885..6cc5285 100644
--- a/platform/linux-generic/odp_ticketlock.c
+++ b/platform/linux-generic/odp_ticketlock.c
@@ -45,7 +45,7 @@  void odp_ticketlock_unlock(odp_ticketlock_t *ticketlock)
 }
 
 
-int odp_ticketlock_is_locked(odp_ticketlock_t *ticketlock)
+bool odp_ticketlock_is_locked(odp_ticketlock_t *ticketlock)
 {
 	return ticketlock->cur_ticket != ticketlock->next_ticket;
 }