guilabel.cpp: Remove length limitation
For some unknown reason, labels could not have their text reassigned to a longer text, being limited to the length of the first text that was ever assigned to it. This seems like an arbitrary limitation that does not introduce any regressions, so it is probably reasonable to remove it. Additionally, future commits will make use of labels whose text could be reassigned several times. git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9487 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 2536884b05c76ec5788ef59fc8556cc5a9fe3705 Former-commit-id: 2deec2b67b979e173b4f878dbed1811ebdde475e
This commit is contained in:
parent
73dd7a7d49
commit
b584e3668c
1 changed files with 3 additions and 7 deletions
|
@ -218,13 +218,9 @@ gfuiLabelSetText(tGfuiLabel *label, const char *text)
|
|||
if (!text)
|
||||
return;
|
||||
|
||||
// Reallocate label->text if maxlen is nul (in case label->text is empty).
|
||||
if (label->maxlen <= 0)
|
||||
{
|
||||
free(label->text);
|
||||
label->maxlen = strlen(text);
|
||||
label->text = (char*)calloc(label->maxlen+1, sizeof(char));
|
||||
}
|
||||
free(label->text);
|
||||
label->maxlen = strlen(text);
|
||||
label->text = (char*)calloc(label->maxlen+1, sizeof(char));
|
||||
|
||||
// Update the text.
|
||||
strncpy(label->text, text, label->maxlen);
|
||||
|
|
Loading…
Reference in a new issue