diff options
Diffstat (limited to 'geometry.c')
-rw-r--r-- | geometry.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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; } |