On 14/07/2023 2:44 pm, Nicola Vetrini wrote:
>
> On 14/07/23 15:04, Andrew Cooper wrote:
>> Typedef-ing a naked pointer like this an anti-pattern which is best
>> avoided.
>
> s/this an/this is an/
>
>> Furthermore, it's bad to pass a string literate in a mutable type. 
>> Delete the
>
> s/literate/literal/

Fixed, thanks.  And the 3rd typo below.

>
>> type entirely, and replace it with a plain 'const char *'.
>>
>> This highlights two futher bugs.  acpi_get_table() already had a
>> mismatch in
>> types between it's declaration and definition, and we have
>> declarations for
>> acpi_get_handle() and acpi_get_table_header() but no definition at
>> all (nor
>> any callers).
>>
>> This fixes violations of MISRA Rule 7.4:
>>
>>    A string literal shall not be assigned to an object unless the
>> object's type
>>    is "pointer to const-qualified char".
>>
>> and of Rule 8.3:
>>
>>    All declarations of an object or function shall use the same names
>> and type
>>    qualifiers.
>>
>> and of Rule 8.6:
>>
>>    An identifier with external linkage shall have exactly one external
>>    definition.
>
> The choice of rules looks good to me, but perhaps Roberto has some
> additional insight on this.

Thanks.

~Andrew

Reply via email to