[ 
https://issues.apache.org/jira/browse/AVRO-968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13161386#comment-13161386
 ] 

Vivek Nadkarni commented on AVRO-968:
-------------------------------------

On a related note, I see significant duplicated code in avro_value_equal_fast() 
and avro_value_cmp_fast(). Couldn't avro_value_equal_fast() be rewritten more 
simply as

int avro_value_equal_fast( avro_value_t *val1, avro_value_t *val2)
{
    return ( avro_value_cmp_fast( val1, val2 ) == 0 );
}

Thanks,
Vivek

                
> Avro C - avro_value_cmp_fast() may return garbage value for AVRO_STRING 
> comparison
> ----------------------------------------------------------------------------------
>
>                 Key: AVRO-968
>                 URL: https://issues.apache.org/jira/browse/AVRO-968
>             Project: Avro
>          Issue Type: Bug
>          Components: c
>    Affects Versions: 1.6.1, 1.6.2, 1.7.0
>         Environment: All. Currently using gcc 4.6.1 on Ubuntu 11.10.
>            Reporter: Vivek Nadkarni
>            Priority: Minor
>             Fix For: 1.6.2, 1.7.0
>
>         Attachments: AVRO-968.patch
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Compiler shows a warning that variables may be used uninitialized in 
> avro_value_cmp_fast():
> /home/user/avro-trunk/lang/c/src/value.c: In function 'avro_value_cmp_fast':
> /home/user/avro-trunk/lang/c/src/value.c:387:13: warning: 'size2' may be used 
> uninitialized in this function [-Wuninitialized]
> /home/user/avro-trunk/lang/c/src/value.c:387:13: warning: 'size1' may be used 
> uninitialized in this function [-Wuninitialized]
> /home/user/avro-trunk/lang/c/src/value.c:388:11: warning: 'buf1' may be used 
> uninitialized in this function [-Wuninitialized]
> /home/user/avro-trunk/lang/c/src/value.c:388:11: warning: 'buf2' may be used 
> uninitialized in this function [-Wuninitialized]
> Examining the file shows that the warnings are real, and the variables size1, 
> buf1, size2, buf2 should be loaded before they are used. The simple fix is to 
> copy matching code from the function avro_value_equal_fast(). I will attach 
> that code in an upcoming patch. 
> Cheers,
> Vivek

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to