diff options
Diffstat (limited to 'src/internal.c')
-rw-r--r-- | src/internal.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/internal.c b/src/internal.c index c607fa7..06bf416 100644 --- a/src/internal.c +++ b/src/internal.c @@ -47,6 +47,10 @@ puglSetBlob(PuglBlob* const dest, const void* const data, const size_t len) void puglSetString(char** dest, const char* string) { + if (*dest == string) { + return; + } + const size_t len = string ? strlen(string) : 0U; if (!len) { @@ -58,6 +62,19 @@ puglSetString(char** dest, const char* string) } } +PuglStatus +puglStoreViewString(PuglView* const view, + const PuglStringHint key, + const char* const value) +{ + if ((unsigned)key >= 0 && (unsigned)key < PUGL_NUM_STRING_HINTS) { + puglSetString(&view->strings[key], value); + return PUGL_SUCCESS; + } + + return PUGL_BAD_PARAMETER; +} + uint32_t puglDecodeUTF8(const uint8_t* buf) { |