From 0908d3dccb06cad94a4fae9c565d704147121302 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 16 Oct 2026 12:21:12 +0000 Subject: [PATCH] Don't bother working out width for fuzzy match without positions since it is not needed. --- format.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/format.c b/format.c index 3913be846..f14d9cc63 100644 --- a/format.c +++ b/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.430 2026/10/16 07:59:06 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.431 2026/10/16 12:21:12 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -5084,11 +5084,13 @@ format_match_fuzzy(const char *pattern, const char *text, int positions) bitstr_t *bs; char *value; size_t size; - u_int i, width; + u_int i, width = 1; - width = format_width(text); - if (width == 0) - width = 1; + if (positions) { + width = format_width(text); + if (width == 0) + width = 1; + } bs = fuzzy_match(pattern, text, width, NULL); if (bs == NULL) return (xstrdup(positions ? "" : "0"));