From: Emil Velikov Date: Tue, 8 Oct 2024 17:04:34 +0000 (+0100) Subject: libkmod: use strbuf_pushchars() where possible X-Git-Tag: v34~252 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=76212435e8a600cd54c658df74c19379a2593b26;p=thirdparty%2Fkmod.git libkmod: use strbuf_pushchars() where possible Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/174 Signed-off-by: Lucas De Marchi --- diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c index e1808622..4280be8d 100644 --- a/libkmod/libkmod-index.c +++ b/libkmod/libkmod-index.c @@ -494,15 +494,10 @@ static void index_searchwild__allvalues(struct index_node_f *node, static void index_searchwild__all(struct index_node_f *node, int j, struct strbuf *buf, const char *subkey, struct index_value **out) { - size_t pushed = 0; + size_t pushed; int ch; - while (node->prefix[j]) { - ch = node->prefix[j]; - - pushed += strbuf_pushchar(buf, ch); - j++; - } + pushed = strbuf_pushchars(buf, &node->prefix[j]); for (ch = node->first; ch <= node->last; ch++) { struct index_node_f *child = index_readchild(node, ch); @@ -985,15 +980,10 @@ static void index_mm_searchwild_allvalues(struct index_mm_node *node, static void index_mm_searchwild_all(struct index_mm_node *node, int j, struct strbuf *buf, const char *subkey, struct index_value **out) { - size_t pushed = 0; + size_t pushed; int ch; - while (node->prefix[j]) { - ch = node->prefix[j]; - - pushed += strbuf_pushchar(buf, ch); - j++; - } + pushed = strbuf_pushchars(buf, &node->prefix[j]); for (ch = node->first; ch <= node->last; ch++) { struct index_mm_node *child = index_mm_readchild(node, ch);