summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2025-05-02 08:46:40 -0600
committerSimon Glass <[email protected]>2025-05-30 09:49:32 +0100
commit87750b027691cd67a20ae6c5b95df65c33e8294e (patch)
tree0089c864132dd9c27a237f62470b32c0dc16e0f2 /include
parent589e4ccacfc6ef347a78386b8bedc666911e9c4c (diff)
expo: Allow strings to be editable
In some cases dynamic text is needed, e.g. for a menu countdown. Add a function which handles this, allowing the caller to take control of the text that is shown on each render. Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/expo.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/expo.h b/include/expo.h
index 32d69f269a7..7c6ab4bf630 100644
--- a/include/expo.h
+++ b/include/expo.h
@@ -470,6 +470,23 @@ int expo_str(struct expo *exp, const char *name, uint id, const char *str);
const char *expo_get_str(struct expo *exp, uint id);
/**
+ * expo_edit_str() - Make a string writeable
+ *
+ * This allows a string to be updated under the control of the caller. The
+ * buffer must remain valid while the expo is active.
+ *
+ * @exp: Expo to use
+ * @id: String ID to look up
+ * @orig: If non-NULL, returns the original buffer, which can be used by the
+ * caller. It is no-longer used by expo so must be uninited by the caller.
+ * It contains a snapshot of the string contents
+ * @copyp: Returns a pointer to the new, writeable buffer
+ * Return: 0 if OK, -ENOENT if the id was not found, -ENOMEM if out of memory
+ */
+int expo_edit_str(struct expo *exp, uint id, struct abuf *orig,
+ struct abuf **copyp);
+
+/**
* expo_set_display() - set the display to use for a expo
*
* @exp: Expo to update