Patch for strstr_binary

Dave Smith dizzyd@REDACTED
Tue Dec 13 06:33:05 CET 2005

On Dec 12, 2005, at 7:53 PM, Mikael Pettersson wrote:

> This isn't ANSI-C and won't compile with e.g. gcc-2.95.3.
> You should make a single block of the variable declarations
> at the beginning of this scope, and do the initialisations
> as assignments.

Fixed in attached patch. I've spent too long outside of strict C  
world. :)

> These (int) casts are broken on 64-bit machines. Replace them
> with (long) casts. Better yet, "index = cur - big_ptr;"
> should have the same effect and be 100% kosher.

You have to cast pointers if you want an int out of them, at least  
according to my version of gcc. However, I did correct the casts to  
be longs instead of ints.

> No stray empty lines please.

Fixed in attached patch.

Thanks for the feedback. :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: strstr_binary.patch
Type: application/octet-stream
Size: 1830 bytes
Desc: not available
URL: <>
-------------- next part --------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the erlang-questions mailing list