Codingstyle
This commit is contained in:
parent
16d213d4ed
commit
213013e68e
1 changed files with 7 additions and 5 deletions
|
@ -382,10 +382,10 @@ const GWidgetStyle *gwinGetDefaultStyle(void) {
|
||||||
return defaultStyle;
|
return defaultStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gwinSetText(GHandle gh, const char *text, bool_t useAlloc) {
|
void gwinSetText(GHandle gh, const char *text, bool_t useAlloc) {
|
||||||
if (!(gh->flags & GWIN_FLG_WIDGET))
|
if (!(gh->flags & GWIN_FLG_WIDGET)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Dispose of the old string
|
// Dispose of the old string
|
||||||
if ((gh->flags & GWIN_FLG_ALLOCTXT)) {
|
if ((gh->flags & GWIN_FLG_ALLOCTXT)) {
|
||||||
|
@ -397,9 +397,9 @@ void gwinSetText(GHandle gh, const char *text, bool_t useAlloc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alloc the new text if required
|
// Alloc the new text if required
|
||||||
if (!text || !*text)
|
if (!text || !*text) {
|
||||||
gw->text = "";
|
gw->text = "";
|
||||||
else if (useAlloc) {
|
} else if (useAlloc) {
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
if ((str = gfxAlloc(strlen(text)+1))) {
|
if ((str = gfxAlloc(strlen(text)+1))) {
|
||||||
|
@ -407,8 +407,10 @@ void gwinSetText(GHandle gh, const char *text, bool_t useAlloc) {
|
||||||
strcpy(str, text);
|
strcpy(str, text);
|
||||||
}
|
}
|
||||||
gw->text = (const char *)str;
|
gw->text = (const char *)str;
|
||||||
} else
|
} else {
|
||||||
gw->text = text;
|
gw->text = text;
|
||||||
|
}
|
||||||
|
|
||||||
_gwinUpdate(gh);
|
_gwinUpdate(gh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue