JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Remove CEIL macro
[st.git] / st.c
diff --git a/st.c b/st.c
index 17142a4..2b6b717 100644 (file)
--- a/st.c
+++ b/st.c
@@ -76,8 +76,7 @@ char *argv0;
 #define LIMIT(x, a, b)    (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
 #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)/10E6)
-#define CEIL(x) (((x) != (int) (x)) ? (x) + 1 : (x))
+#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + (t1.tv_nsec-t2.tv_nsec)/1E6)
 #define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit)))
 
 #define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
@@ -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);
@@ -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);
@@ -3753,7 +3753,7 @@ run(void) {
 
                clock_gettime(CLOCK_MONOTONIC, &now);
                drawtimeout.tv_sec = 0;
-               drawtimeout.tv_nsec = (1000/xfps) * 10E6;
+               drawtimeout.tv_nsec = (1000/xfps) * 1E6;
                tv = &drawtimeout;
 
                dodraw = 0;
@@ -3790,7 +3790,7 @@ run(void) {
                                                        > blinktimeout) {
                                                drawtimeout.tv_nsec = 1000;
                                        } else {
-                                               drawtimeout.tv_nsec = (10E6 * \
+                                               drawtimeout.tv_nsec = (1E6 * \
                                                        (blinktimeout - \
                                                        TIMEDIFF(now,
                                                                lastblink)));