[hackers] [st] Remove CEIL macro || Roberto E. Vargas Caballero
commit 77569526c0166e6364bb635fceb8eeabd58ce683
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Thu Jun 26 12:37:06 2014 +0200
Remove CEIL macro
This macro was not correct in some cases, and it was used only in
one place, where we did'nt get any benefit in performance of in size,
so the macro is removed and ceilf is used instead of it. The only
function needed from math.h is ceilf, so this patch defines the
prototype of it instead of including math.h.
diff --git a/config.mk b/config.mk
index 97afa2c..6d90f86 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -14,7 +14,7 @@ X11LIB = /usr/X11R6/lib
INCS = -I. -I/usr/include -I${X11INC} \
`pkg-config --cflags fontconfig` \
`pkg-config --cflags freetype2`
-LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lutil -lXext -lXft \
+LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lX11 -lutil -lXext -lXft \
`pkg-config --libs fontconfig` \
`pkg-config --libs freetype2`
diff --git a/st.c b/st.c
index f9c9f7a..2b6b717 100644
--- a/st.c
+++ b/st.c
_AT_@ -77,7 +77,6 @@ char *argv0;
#define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || (a).bg != (b).bg)
#define IS_SET(flag) ((term.mode & (flag)) != 0)
#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + (t1.tv_nsec-t2.tv_nsec)/1E6)
-#define CEIL(x) (((x) != (int) (x)) ? (x) + 1 : (x))
#define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit)))
#define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
_AT_@ -2892,6 +2891,7 @@ xloadfonts(char *fontstr, double fontsize) {
FcPattern *pattern;
FcResult r_sz, r_psz;
double fontval;
+ float ceilf(float);
if(fontstr[0] == '-') {
pattern = XftXlfdParse(fontstr, False, False);
_AT_@ -2937,8 +2937,8 @@ xloadfonts(char *fontstr, double fontsize) {
}
/* Setting character width and height. */
- xw.cw = CEIL(dc.font.width * cwscale);
- xw.ch = CEIL(dc.font.height * chscale);
+ xw.cw = ceilf(dc.font.width * cwscale);
+ xw.ch = ceilf(dc.font.height * chscale);
FcPatternDel(pattern, FC_SLANT);
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
Received on Thu Jun 26 2014 - 12:39:58 CEST
This archive was generated by hypermail 2.3.0
: Thu Jun 26 2014 - 12:48:08 CEST