summaryrefslogtreecommitdiff
path: root/geometry.c
diff options
context:
space:
mode:
Diffstat (limited to 'geometry.c')
-rw-r--r--geometry.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/geometry.c b/geometry.c
index bce1723..50df5eb 100644
--- a/geometry.c
+++ b/geometry.c
@@ -3263,7 +3263,6 @@ FontFromParts(Atom fontTok,
Atom slantTok,
Atom setWidthTok, Atom varTok, int size, Atom encodingTok)
{
- int totalSize;
const char *font, *weight, *slant, *setWidth, *variant, *encoding;
char *rtrn;
@@ -3282,7 +3281,13 @@ FontFromParts(Atom fontTok,
None ? XkbAtomGetString(NULL, encodingTok) : DFLT_ENCODING);
if (size == 0)
size = DFLT_SIZE;
- totalSize =
+
+#ifdef HAVE_ASPRINTF
+ if (asprintf(&rtrn, FONT_TEMPLATE, font, weight, slant,
+ setWidth, variant, size, encoding) < 0)
+ rtrn = NULL;
+#else
+ size_t totalSize =
strlen(FONT_TEMPLATE) + strlen(font) + strlen(weight) + strlen(slant);
totalSize += strlen(setWidth) + strlen(variant) + strlen(encoding);
rtrn = calloc(totalSize, 1);
@@ -3291,6 +3296,7 @@ FontFromParts(Atom fontTok,
snprintf(rtrn, totalSize, FONT_TEMPLATE, font, weight, slant,
setWidth, variant, size, encoding);
}
+#endif
return rtrn;
}