aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto E. Vargas Caballero <k0ga@shike2.com>2014-06-26 12:37:06 +0200
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2014-06-26 12:37:06 +0200
commit77569526c0166e6364bb635fceb8eeabd58ce683 (patch)
treef38c6555363cd6432a4cacdbe88bd372e99a8af6
parent19d095717f656d844cd9d696d9c921a0821a5ea7 (diff)
downloadst-77569526c0166e6364bb635fceb8eeabd58ce683.tar.gz
st-77569526c0166e6364bb635fceb8eeabd58ce683.zip
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.
-rw-r--r--config.mk2
-rw-r--r--st.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/config.mk b/config.mk
index 97afa2c..6d90f86 100644
--- a/config.mk
+++ b/config.mk
@@ -14,7 +14,7 @@ X11LIB = /usr/X11R6/lib
14INCS = -I. -I/usr/include -I${X11INC} \ 14INCS = -I. -I/usr/include -I${X11INC} \
15 `pkg-config --cflags fontconfig` \ 15 `pkg-config --cflags fontconfig` \
16 `pkg-config --cflags freetype2` 16 `pkg-config --cflags freetype2`
17LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lutil -lXext -lXft \ 17LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lX11 -lutil -lXext -lXft \
18 `pkg-config --libs fontconfig` \ 18 `pkg-config --libs fontconfig` \
19 `pkg-config --libs freetype2` 19 `pkg-config --libs freetype2`
20 20
diff --git a/st.c b/st.c
index f9c9f7a..2b6b717 100644
--- a/st.c
+++ b/st.c
@@ -77,7 +77,6 @@ char *argv0;
77#define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || (a).bg != (b).bg) 77#define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || (a).bg != (b).bg)
78#define IS_SET(flag) ((term.mode & (flag)) != 0) 78#define IS_SET(flag) ((term.mode & (flag)) != 0)
79#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + (t1.tv_nsec-t2.tv_nsec)/1E6) 79#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + (t1.tv_nsec-t2.tv_nsec)/1E6)
80#define CEIL(x) (((x) != (int) (x)) ? (x) + 1 : (x))
81#define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit))) 80#define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit)))
82 81
83#define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b)) 82#define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
@@ -2892,6 +2891,7 @@ xloadfonts(char *fontstr, double fontsize) {
2892 FcPattern *pattern; 2891 FcPattern *pattern;
2893 FcResult r_sz, r_psz; 2892 FcResult r_sz, r_psz;
2894 double fontval; 2893 double fontval;
2894 float ceilf(float);
2895 2895
2896 if(fontstr[0] == '-') { 2896 if(fontstr[0] == '-') {
2897 pattern = XftXlfdParse(fontstr, False, False); 2897 pattern = XftXlfdParse(fontstr, False, False);
@@ -2937,8 +2937,8 @@ xloadfonts(char *fontstr, double fontsize) {
2937 } 2937 }
2938 2938
2939 /* Setting character width and height. */ 2939 /* Setting character width and height. */
2940 xw.cw = CEIL(dc.font.width * cwscale); 2940 xw.cw = ceilf(dc.font.width * cwscale);
2941 xw.ch = CEIL(dc.font.height * chscale); 2941 xw.ch = ceilf(dc.font.height * chscale);
2942 2942
2943 FcPatternDel(pattern, FC_SLANT); 2943 FcPatternDel(pattern, FC_SLANT);
2944 FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); 2944 FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);