expo: Allow setting the start of the dynamic-ID range

Provide a way to set this value so that it is easy to separate the
statically allocated IDs (generated by the caller) from those
generated dynamically by expo itself.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2023-06-01 10:22:47 -06:00 committed by Tom Rini
parent b828ed7d79
commit 9af341502c
4 changed files with 37 additions and 10 deletions

View file

@ -56,6 +56,21 @@ void expo_destroy(struct expo *exp)
free(exp);
}
uint resolve_id(struct expo *exp, uint id)
{
if (!id)
id = exp->next_id++;
else if (id >= exp->next_id)
exp->next_id = id + 1;
return id;
}
void expo_set_dynamic_start(struct expo *exp, uint dyn_start)
{
exp->next_id = dyn_start;
}
int expo_str(struct expo *exp, const char *name, uint id, const char *str)
{
struct expo_string *estr;