aboutsummaryrefslogtreecommitdiffstats
path: root/src/internal.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-06-06 21:01:12 -0400
committerDavid Robillard <d@drobilla.net>2022-06-08 22:01:15 -0400
commit8f505887090d0d6a16a0f3b06638fa297b9a4255 (patch)
tree28fb5c9fa2cc239f260ba207f923de2844b43488 /src/internal.c
parent27ce10b5039e931eaad33e9499a630552d4e1f06 (diff)
downloadpugl-8f505887090d0d6a16a0f3b06638fa297b9a4255.tar.gz
pugl-8f505887090d0d6a16a0f3b06638fa297b9a4255.tar.bz2
pugl-8f505887090d0d6a16a0f3b06638fa297b9a4255.zip
Separate platform.h from internal.h
This makes the internal header structure match the "kinds" of definition inside Pugl: common implementations of public API, things available internally to platform implementations, and things the platform must define.
Diffstat (limited to 'src/internal.c')
-rw-r--r--src/internal.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/src/internal.c b/src/internal.c
index a3067f1..69f220e 100644
--- a/src/internal.c
+++ b/src/internal.c
@@ -12,17 +12,6 @@
#include <stdlib.h>
#include <string.h>
-void
-puglSetString(char** dest, const char* string)
-{
- if (*dest != string) {
- const size_t len = strlen(string);
-
- *dest = (char*)realloc(*dest, len + 1);
- strncpy(*dest, string, len + 1);
- }
-}
-
PuglStatus
puglSetBlob(PuglBlob* const dest, const void* const data, const size_t len)
{
@@ -47,7 +36,17 @@ puglSetBlob(PuglBlob* const dest, const void* const data, const size_t len)
return PUGL_SUCCESS;
}
-/// Return the code point for buf, or the replacement character on error
+void
+puglSetString(char** dest, const char* string)
+{
+ if (*dest != string) {
+ const size_t len = strlen(string);
+
+ *dest = (char*)realloc(*dest, len + 1);
+ strncpy(*dest, string, len + 1);
+ }
+}
+
uint32_t
puglDecodeUTF8(const uint8_t* buf)
{
@@ -96,12 +95,6 @@ puglDecodeUTF8(const uint8_t* buf)
return 0xFFFD;
}
-static inline bool
-puglMustConfigure(PuglView* view, const PuglConfigureEvent* configure)
-{
- return !!memcmp(configure, &view->lastConfigure, sizeof(PuglConfigureEvent));
-}
-
PuglStatus
puglDispatchSimpleEvent(PuglView* view, const PuglEventType type)
{
@@ -113,6 +106,12 @@ puglDispatchSimpleEvent(PuglView* view, const PuglEventType type)
return puglDispatchEvent(view, &event);
}
+static inline bool
+puglMustConfigure(PuglView* view, const PuglConfigureEvent* configure)
+{
+ return !!memcmp(configure, &view->lastConfigure, sizeof(PuglConfigureEvent));
+}
+
PuglStatus
puglConfigure(PuglView* view, const PuglEvent* event)
{