Skip to main content

zstrcmp

Function zstrcmp 

Source
pub fn zstrcmp(a: &str, b: &str, flags: u32) -> Ordering
Expand description

Compare two strings under the SORTIT_* bits, delegating to the canonical port of zstrcmp (Src/sort.c:191) at crate::ported::sort::zstrcmp.

This function previously carried a SECOND, from-scratch comparator with its own numeric_compare / extract_number helpers. That copy had the same defect the ported one was fixed for in Src/sort.c:155 — it entered the numeric branch on a_is_digit || b_is_digit where C requires idigit(*as) && idigit(*bs), so a digit facing a non-digit compared as a number against 0 instead of falling through to collation. It had no callers, which is exactly why the defect survived: nothing exercised it. Route to the one comparator rather than keep a divergent twin alive.