aboutsummaryrefslogtreecommitdiffstats
path: root/src/internal.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-05-12 17:09:05 -0400
committerDavid Robillard <d@drobilla.net>2023-05-12 17:16:24 -0400
commit049a7254beb94d33e315930f42b434ded6e29fa5 (patch)
tree7e0695bf93d8e1602067f6391f1e1c4c3ffe4526 /src/internal.c
parent70a01e11a5c7b6c47717eb4b324e30ee331a817a (diff)
downloadpugl-049a7254beb94d33e315930f42b434ded6e29fa5.tar.gz
pugl-049a7254beb94d33e315930f42b434ded6e29fa5.tar.bz2
pugl-049a7254beb94d33e315930f42b434ded6e29fa5.zip
Factor out puglIsValidSize() and use consistent rules everywhere
Diffstat (limited to 'src/internal.c')
-rw-r--r--src/internal.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/internal.c b/src/internal.c
index d9f034e..cff66be 100644
--- a/src/internal.c
+++ b/src/internal.c
@@ -12,6 +12,12 @@
#include <stdlib.h>
#include <string.h>
+bool
+puglIsValidSize(const PuglViewSize size)
+{
+ return size.width && size.height;
+}
+
void
puglEnsureHint(PuglView* const view, const PuglViewHint hint, const int value)
{
@@ -110,12 +116,6 @@ puglDecodeUTF8(const uint8_t* buf)
return 0xFFFD;
}
-static inline bool
-isValidSize(const double width, const double height)
-{
- return width > 0.0 && height > 0.0;
-}
-
PuglStatus
puglPreRealize(PuglView* const view)
{
@@ -130,8 +130,7 @@ puglPreRealize(PuglView* const view)
}
// Ensure that the default size is set to a valid size
- const PuglViewSize defaultSize = view->sizeHints[PUGL_DEFAULT_SIZE];
- if (!isValidSize(defaultSize.width, defaultSize.height)) {
+ if (!puglIsValidSize(view->sizeHints[PUGL_DEFAULT_SIZE])) {
return PUGL_BAD_CONFIGURATION;
}