[PATCH 1/3] core-util: Add pa_safe_streq

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

 



On 05/22/2013 03:06 PM, Tanu Kaskinen wrote:
> On Wed, 2013-05-22 at 14:13 +0200, David Henningsson wrote:
>> Like pa_streq, but does not blow up on NULL pointers.
>>
>> Signed-off-by: David Henningsson <david.henningsson at canonical.com>
>> ---
>>   src/pulsecore/core-util.h |    9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
>> index 15e6809..4656916 100644
>> --- a/src/pulsecore/core-util.h
>> +++ b/src/pulsecore/core-util.h
>> @@ -208,6 +208,15 @@ void pa_unset_env_recorded(void);
>>   pa_bool_t pa_in_system_mode(void);
>>
>>   #define pa_streq(a,b) (!strcmp((a),(b)))
>> +
>> +/* Like pa_streq, but does not blow up on NULL pointers. */
>> +static inline bool pa_safe_streq(const char *a, const char *b)
>> +{
>> +	if (a == NULL || b == NULL)
>> +		return a == b;
>> +	return pa_streq(a, b);
>> +}
>> +
>>   pa_bool_t pa_str_in_list_spaces(const char *needle, const char *haystack);
>>
>>   char *pa_get_host_name_malloc(void);
>
> This patch uses tabs for indentation. Otherwise ack for all three
> patches.
>

Thanks for the review. Pushed now.


-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux