Skip to content

Remove unnecessary byteorder dependency

Uli Schlachter requested to merge psychon/librsvg:remove-byteorder into main

There is a single place in the code base using byteorder. This writes a pixel value as u32 in native endian into a byte array aka [u8].

Instead of using byteorder for this, it is actually simpler to use u32::to_ne_bytes() to get the bytes and copy_from_slice() to do the copy.

copy_from_slice() panics if the slice has the wrong length. The same is true for the existing code which uses expect() to panic in this case.

Signed-off-by: Uli Schlachter psychon@znc.in


Why? I am not actually sure. This seemed like such a small function where the byteorder crate does not "buy" much. However, this MR does not get rid of the byteorder dependency, since this crate is still used by selectors -> fxhash -> byteorder. Still, I guess this doesn't hurt...? Feel free to disagree and reject this.

Merge request reports