Sat, 14 Jun 2025 11:17:17 +0200
make var name parameters const
| ui/common/context.c | file | annotate | diff | comparison | revisions | |
| ui/common/context.h | file | annotate | diff | comparison | revisions | |
| ui/common/types.c | file | annotate | diff | comparison | revisions | |
| ui/ui/toolkit.h | file | annotate | diff | comparison | revisions |
--- a/ui/common/context.c Sat Jun 14 11:05:57 2025 +0200 +++ b/ui/common/context.c Sat Jun 14 11:17:17 2025 +0200 @@ -409,7 +409,7 @@ } } -void uic_reg_var(UiContext *ctx, char *name, UiVarType type, void *value) { +void uic_reg_var(UiContext *ctx, const char *name, UiVarType type, void *value) { // TODO: do we need/want this? Why adding vars to a context after // widgets reference these? Workarounds: // 1. add vars to ctx before creating ui
--- a/ui/common/context.h Sat Jun 14 11:05:57 2025 +0200 +++ b/ui/common/context.h Sat Jun 14 11:17:17 2025 +0200 @@ -141,7 +141,7 @@ void uic_save_var2(UiVar *var); void uic_unbind_var(UiVar *var); -void uic_reg_var(UiContext *ctx, char *name, UiVarType type, void *value); +void uic_reg_var(UiContext *ctx, const char *name, UiVarType type, void *value); void uic_remove_bound_var(UiContext *ctx, UiVar *var);
--- a/ui/common/types.c Sat Jun 14 11:05:57 2025 +0200 +++ b/ui/common/types.c Sat Jun 14 11:17:17 2025 +0200 @@ -249,7 +249,7 @@ // types // public functions -UiInteger* ui_int_new(UiContext *ctx, char *name) { +UiInteger* ui_int_new(UiContext *ctx, const char *name) { UiInteger *i = ui_malloc(ctx, sizeof(UiInteger)); memset(i, 0, sizeof(UiInteger)); if(name) { @@ -258,7 +258,7 @@ return i; } -UiDouble* ui_double_new(UiContext *ctx, char *name) { +UiDouble* ui_double_new(UiContext *ctx, const char *name) { UiDouble *d = ui_malloc(ctx, sizeof(UiDouble)); memset(d, 0, sizeof(UiDouble)); if(name) { @@ -267,7 +267,7 @@ return d; } -UiString* ui_string_new(UiContext *ctx, char *name) { +UiString* ui_string_new(UiContext *ctx, const char *name) { UiString *s = ui_malloc(ctx, sizeof(UiString)); memset(s, 0, sizeof(UiString)); if(name) { @@ -276,7 +276,7 @@ return s; } -UiText* ui_text_new(UiContext *ctx, char *name) { +UiText* ui_text_new(UiContext *ctx, const char *name) { UiText *t = ui_malloc(ctx, sizeof(UiText)); memset(t, 0, sizeof(UiText)); if(name) { @@ -285,7 +285,7 @@ return t; } -UiRange* ui_range_new(UiContext *ctx, char *name) { +UiRange* ui_range_new(UiContext *ctx, const char *name) { UiRange *r = ui_malloc(ctx, sizeof(UiRange)); memset(r, 0, sizeof(UiRange)); if(name) { @@ -294,7 +294,7 @@ return r; } -UIEXPORT UiGeneric* ui_generic_new(UiContext *ctx, char *name) { +UIEXPORT UiGeneric* ui_generic_new(UiContext *ctx, const char *name) { UiGeneric *g = ui_malloc(ctx, sizeof(UiGeneric)); memset(g, 0, sizeof(UiGeneric)); if(name) {
--- a/ui/ui/toolkit.h Sat Jun 14 11:05:57 2025 +0200 +++ b/ui/ui/toolkit.h Sat Jun 14 11:17:17 2025 +0200 @@ -531,12 +531,12 @@ // types -UIEXPORT UiInteger* ui_int_new(UiContext *ctx, char *name); -UIEXPORT UiDouble* ui_double_new(UiContext *ctx, char *name); -UIEXPORT UiString* ui_string_new(UiContext *ctx, char *name); -UIEXPORT UiText* ui_text_new(UiContext *ctx, char *name); -UIEXPORT UiRange* ui_range_new(UiContext *ctx, char *name); -UIEXPORT UiGeneric* ui_generic_new(UiContext *ctx, char *name); +UIEXPORT UiInteger* ui_int_new(UiContext *ctx, const char *name); +UIEXPORT UiDouble* ui_double_new(UiContext *ctx, const char *name); +UIEXPORT UiString* ui_string_new(UiContext *ctx, const char *name); +UIEXPORT UiText* ui_text_new(UiContext *ctx, const char *name); +UIEXPORT UiRange* ui_range_new(UiContext *ctx, const char *name); +UIEXPORT UiGeneric* ui_generic_new(UiContext *ctx, const char *name); #define ui_get(v) _Generic(v, \ UiInteger*: ui_int_get, \