From patchwork Sun Jan 18 20:42:47 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1599 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769034; bh=7idLoK5kiQPALttf5o0DXDFqprJoybPmmYj6VhGED94=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=kOs6seGPRhsaZUf/JhepRyLydx/+xMOXDpgzbstr9b8F8PHLOlGIEL0BE9mRMt4Bd oKPb6Sh87vfH22mHxSRhr0Um2lgEkfi5gTFjV7rMaFpX9F5xBdxiYhSjXNpQFO4RPb Uw/PzaXB/I8fL/mQvhEq3fa7qxJUxck2vMclW+ahmzTcK2nqfaxv5NfOoiu8gasdK0 pS9iRr/sWGnUL16mRJ898k+weF0sKS2uKvkOFZKrl9ExhOYs1BvgChibSdKZIdAmR6 EJNFyvWNQmFC9Ux40J52Z1vGVmJd4rjeZ7YpMwpgEPVB3recnzVHfLtzAQCl4X504k ktfrFL2vZ0GRA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8C0706948C for ; Sun, 18 Jan 2026 13:43:54 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id gFZWalqTKFPk for ; Sun, 18 Jan 2026 13:43:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769034; bh=7idLoK5kiQPALttf5o0DXDFqprJoybPmmYj6VhGED94=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=kOs6seGPRhsaZUf/JhepRyLydx/+xMOXDpgzbstr9b8F8PHLOlGIEL0BE9mRMt4Bd oKPb6Sh87vfH22mHxSRhr0Um2lgEkfi5gTFjV7rMaFpX9F5xBdxiYhSjXNpQFO4RPb Uw/PzaXB/I8fL/mQvhEq3fa7qxJUxck2vMclW+ahmzTcK2nqfaxv5NfOoiu8gasdK0 pS9iRr/sWGnUL16mRJ898k+weF0sKS2uKvkOFZKrl9ExhOYs1BvgChibSdKZIdAmR6 EJNFyvWNQmFC9Ux40J52Z1vGVmJd4rjeZ7YpMwpgEPVB3recnzVHfLtzAQCl4X504k ktfrFL2vZ0GRA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7AAE369491 for ; Sun, 18 Jan 2026 13:43:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769033; bh=UfjXGehX2WnbCrXtFv/Z3Fa9yu05dTWqYa8C8vzfSXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hmQiErL6E0fymMwiAMjqkYpehlf+gKIrXD4NwEKnxxUnHPhMN+BuNvIs/9HGePoNw 1cKm/0fN03dgCeWa0wED4KjDufCnCthHo4QjLflpdtZCmxr+TytFQsHmB19X+Z6zdv BCi1JQC39F87ERMIFi42qRbvbn0/CxZjhSdIb4hIdTO5ICnluANlq1Jz1PAsd2XQPt 6KCH6lVIOpQm05m7cxS5+UEQLbvSOe00RfsmKWAqr/4mKk8qy9kj/ZSRSozvoCsXeq pcuAhMOHZlZ0gFT4UUUKJXcqsNBvl2p/XSpDsvhk0Y7rnJyU8deVitkIVlkgnjmzYT WEo+8x5Gywo0w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 10C686948C; Sun, 18 Jan 2026 13:43:53 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id NXwzGS9BfzwN; Sun, 18 Jan 2026 13:43:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769029; bh=vjrFlSXRpZCYnq8Kwg3Q0N1OXP7LsppULbdIKJQgb1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KyCpaRU1L+qQQ5kJGVZCjF11AA28/NSVU9z5LmCKFhYHVHcPEVR/sCAzjjkrsyl0c YNkSQeQpMpuOwtKfkPlFhbg3hGhj00WrwjMsc1Sk5XGvZMiilduV67BjQzURWrQ24a 8hYkeNK6Q2Q8aN7/94FIinIAWMqjR6Fghfk0GlzYHS2ftuUhXXerj9o+CEzwK4+Y3A dSqeZsKc6ugP4i49e+yAkJgizLfz/KZ+ig6sQcMcchXvNOEbgwiHA3W4ZA/SlRbIc2 +e6Il+VR7EJyggtxh91kEbrVP7YcqRpEc53yHpRM1T3Nl/xUQ3LlKv+V11L2p/bO+N BQXs2vsRe6JEg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B058C6946A; Sun, 18 Jan 2026 13:43:48 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:42:47 -0700 Message-ID: <20260118204303.1982533-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260118204303.1982533-1-sjg@u-boot.org> References: <20260118204303.1982533-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: RYCOBNCE5MGGWIQL6LLVK5L3UAYRMNOI X-Message-ID-Hash: RYCOBNCE5MGGWIQL6LLVK5L3UAYRMNOI X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/16] expo: Rename textline max_chars to line_chars List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Rename the max_chars field to line_chars to better describe its purpose. This field represents the nominal number of characters in a line, which for textline is also a hard limit. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/cedit.c | 4 ++-- boot/expo_build.c | 6 +++--- boot/expo_dump.c | 2 +- boot/scene_textline.c | 16 ++++++++-------- doc/usage/cmd/cedit.rst | 2 +- include/expo.h | 10 +++++----- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/boot/cedit.c b/boot/cedit.c index d58ae0ba51c..5a334787453 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -538,7 +538,7 @@ static int h_read_settings(struct scene_obj *obj, void *vpriv) tline = (struct scene_obj_textline *)obj; val = ofnode_read_prop(node, obj->name, &len); - if (len >= tline->max_chars) + if (len >= tline->line_chars) return log_msg_ret("str", -ENOSPC); strcpy(abuf_data(&tline->buf), val); break; @@ -708,7 +708,7 @@ static int h_read_settings_env(struct scene_obj *obj, void *vpriv) tline = (struct scene_obj_textline *)obj; value = env_get(var); - if (value && strlen(value) >= tline->max_chars) + if (value && strlen(value) >= tline->line_chars) return log_msg_ret("str", -ENOSPC); if (!value) value = ""; diff --git a/boot/expo_build.c b/boot/expo_build.c index 60a9cd71b7e..76611b4f6d7 100644 --- a/boot/expo_build.c +++ b/boot/expo_build.c @@ -328,17 +328,17 @@ static int textline_build(struct build_info *info, ofnode node, uint edit_id; const char *name; char buf[80]; - u32 max_chars; + u32 line_chars; int ret; name = ofnode_get_name(node); info->err_prop = "max-chars"; - ret = ofnode_read_u32(node, "max-chars", &max_chars); + ret = ofnode_read_u32(node, "max-chars", &line_chars); if (ret) return log_msg_ret("max", -ENOENT); - ret = scene_textline(scn, name, id, max_chars, &ted); + ret = scene_textline(scn, name, id, line_chars, &ted); if (ret < 0) return log_msg_ret("ted", ret); diff --git a/boot/expo_dump.c b/boot/expo_dump.c index 5f9ea22c50a..2cd74e137d4 100644 --- a/boot/expo_dump.c +++ b/boot/expo_dump.c @@ -109,7 +109,7 @@ static void dump_textline(struct dump_ctx *ctx, outf(ctx, "Textline: label_id %x edit_id %x\n", tline->label_id, tline->edit_id); ctx->indent += 2; - outf(ctx, "max_chars %x pos %x\n", tline->max_chars, tline->pos); + outf(ctx, "line_chars %x pos %x\n", tline->line_chars, tline->pos); ctx->indent -= 2; } diff --git a/boot/scene_textline.c b/boot/scene_textline.c index 082b39f2497..2270e1496e9 100644 --- a/boot/scene_textline.c +++ b/boot/scene_textline.c @@ -16,14 +16,14 @@ #include #include "scene_internal.h" -int scene_textline(struct scene *scn, const char *name, uint id, uint max_chars, - struct scene_obj_textline **tlinep) +int scene_textline(struct scene *scn, const char *name, uint id, + uint line_chars, struct scene_obj_textline **tlinep) { struct scene_obj_textline *tline; char *buf; int ret; - if (max_chars >= EXPO_MAX_CHARS) + if (line_chars >= EXPO_MAX_CHARS) return log_msg_ret("chr", -E2BIG); ret = scene_obj_add(scn, name, id, SCENEOBJT_TEXTLINE, @@ -31,12 +31,12 @@ int scene_textline(struct scene *scn, const char *name, uint id, uint max_chars, (struct scene_obj **)&tline); if (ret < 0) return log_msg_ret("obj", -ENOMEM); - if (!abuf_init_size(&tline->buf, max_chars + 1)) + if (!abuf_init_size(&tline->buf, line_chars + 1)) return log_msg_ret("buf", -ENOMEM); buf = abuf_data(&tline->buf); *buf = '\0'; - tline->pos = max_chars; - tline->max_chars = max_chars; + tline->pos = line_chars; + tline->line_chars = line_chars; if (tlinep) *tlinep = tline; @@ -73,7 +73,7 @@ int scene_textline_calc_dims(struct scene_obj_textline *tline, return log_msg_ret("dim", -ENOENT); ret = vidconsole_nominal(cons, txt->gen.font_name, txt->gen.font_size, - tline->max_chars, &bbox); + tline->line_chars, &bbox); if (ret) return log_msg_ret("nom", ret); @@ -246,7 +246,7 @@ int scene_textline_open(struct scene *scn, struct scene_obj_textline *tline) vidconsole_set_cursor_pos(cons, txt->obj.bbox.x0, txt->obj.bbox.y0); vidconsole_entry_start(cons); - cli_cread_init(&scn->cls, abuf_data(&tline->buf), tline->max_chars); + cli_cread_init(&scn->cls, abuf_data(&tline->buf), tline->line_chars); scn->cls.insert = true; scn->cls.putch = scene_textline_putch; ret = vidconsole_entry_save(cons, &scn->entry_save); diff --git a/doc/usage/cmd/cedit.rst b/doc/usage/cmd/cedit.rst index 0eb8f09dc2c..5d2071bdd1a 100644 --- a/doc/usage/cmd/cedit.rst +++ b/doc/usage/cmd/cedit.rst @@ -362,7 +362,7 @@ This shows dumping the cedit:: bbox: (0,0)-(0,0) dims: 0x0 Textline: label_id 39 edit_id 18 - max_chars 20 pos 20 + line_chars 14 pos 14 Object 39 (title): type text flags bbox: (0,0)-(0,0) diff --git a/include/expo.h b/include/expo.h index 9d6300024fc..39245228574 100644 --- a/include/expo.h +++ b/include/expo.h @@ -510,7 +510,7 @@ struct scene_menitem { * @obj: Basic object information * @label_id: ID of the label text object (not string ID), or 0 if none * @edit_id: ID of the editable text object (not string ID) - * @max_chars: Maximum number of characters allowed + * @line_chars: Nominal number of characters in a line (also a hard limit) * @buf: Text buffer containing current text * @pos: Cursor position */ @@ -518,7 +518,7 @@ struct scene_obj_textline { struct scene_obj obj; uint label_id; uint edit_id; - uint max_chars; + uint line_chars; struct abuf buf; uint pos; }; @@ -855,12 +855,12 @@ int scene_menu(struct scene *scn, const char *name, uint id, * @scn: Scene to update * @name: Name to use (this is allocated by this call) * @id: ID to use for the new object (0 to allocate one) - * @max_chars: Maximum length of the textline in characters + * @line_chars: Number of characters in a line (also a hard limit) * @tlinep: If non-NULL, returns the new object * Returns: ID number for the object (typically @id), or -ve on error */ -int scene_textline(struct scene *scn, const char *name, uint id, uint max_chars, - struct scene_obj_textline **tlinep); +int scene_textline(struct scene *scn, const char *name, uint id, + uint line_chars, struct scene_obj_textline **tlinep); /** * scene_box() - create a box