Immediate-Mode-UI / Immediate-Mode-UI/Nuklear
nk_edit_string_zero_terminated realloc
- Dominant language
- C
- Stars
- 11.4k
- Forks
- 686
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 3
Description
does any one have a way to automatically handle realloc'ed string for nk_edit_string
char *name=malloc(1);
name[0]='\0';
...
nk_edit_string_zero_terminated(config->ctx, NK_EDIT_
FIELD, &name[0], 100, nk_filter_default);
when typing in the text field, how to handle the char count typed to use it for realloc for name ; when we don't know the length in advance, but max length is 100;
I know that I can malloc 100 in advance but this is a waste of ram
Contributor guide
Research direction
Start by reading the nk_edit_string_zero_terminated API and the example call in the issue, then determine where buffer sizing and ownership are expected to be handled. Done requires a documented or implemented approach for accepting input up to the stated maximum without requiring an unnecessarily large initial allocation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100