From: Marcus Rueckert Date: 2010-04-23T19:10:33+09:00 Subject: [ruby-core:29759] small patch for syck --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline hi, the attached patch fixes a small compiler warning in the syck code. more information is in the patch file itself. patch is against the 1.8 branch. darix -- openSUSE - SUSE Linux is my linux openSUSE is good for you www.opensuse.org --a8Wt8u1KmwUX3Y2C Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="ruby-1.8.x_yaml2byte.patch" I: Program causes undefined operation (likely same variable used twiceand post/pre incremented in the same expression). e.g. x = x++; Split it in two operations. W: ruby sequence-point yaml2byte.c:67, 104 yaml2byte.c: In function 'bytestring_append': yaml2byte.c:67:21: warning: operation on 'str->buffer' may be undefined yaml2byte.c: In function 'bytestring_extend': yaml2byte.c:104:25: warning: operation on 'str->buffer' may be undefined #define S_REALLOC_N(var,type,n) (var)=(type*)realloc((char*)(var),sizeof(type)*(n)) so the old code expanded to: str->buffer = str->buffer = (char*)realloc((char*)str->buffer, sizeof(char)*str->length + 1) Index: ext/syck/yaml2byte.c =================================================================== --- ext/syck/yaml2byte.c (revision 27446) +++ ext/syck/yaml2byte.c (working copy) @@ -64,7 +64,7 @@ grow = (length - str->remaining) + CHUNKSIZE; str->remaining += grow; str->length += grow; - str->buffer = S_REALLOC_N( str->buffer, char, str->length + 1 ); + S_REALLOC_N( str->buffer, char, str->length + 1 ); assert(str->buffer); } curr = str->buffer + (str->length - str->remaining); @@ -101,7 +101,7 @@ grow = (length - str->remaining) + CHUNKSIZE; str->remaining += grow; str->length += grow; - str->buffer = S_REALLOC_N( str->buffer, char, str->length + 1 ); + S_REALLOC_N( str->buffer, char, str->length + 1 ); } curr = str->buffer + (str->length - str->remaining); from = ext->buffer; --a8Wt8u1KmwUX3Y2C--