scroll_selection_lines = Pixel2Height (dist)
/ SELECTION_SCROLL_LINE_SPEEDUP
+ 1;
- MIN_IT (scroll_selection_lines,
+ min_it (scroll_selection_lines,
SELECTION_SCROLL_MAX_LINES);
}
else
sy = 0;
}
- MIN_IT (nw, (unsigned int) (wrootattr.width - sx));
- MIN_IT (nh, (unsigned int) (wrootattr.height - sy));
+ min_it (nw, (unsigned int) (wrootattr.width - sx));
+ min_it (nh, (unsigned int) (wrootattr.height - sy));
XSync (disp, False);
allowedxerror = -1;
}
if (rs[Rs_saveLines] && (i = atoi (rs[Rs_saveLines])) >= 0)
- saveLines = BOUND_POSITIVE_INT16 (i);
+ saveLines = min (i, MAX_POSITIVE_INT16);
#if ENABLE_FRILLS
if (rs[Rs_int_bwidth] && (i = atoi (rs[Rs_int_bwidth])) >= 0)
- int_bwidth = min (i, 100); /* arbitrary limit */
+ int_bwidth = min (i, MAX_POSITIVE_INT16);
+
if (rs[Rs_ext_bwidth] && (i = atoi (rs[Rs_ext_bwidth])) >= 0)
- ext_bwidth = min (i, 100); /* arbitrary limit */
+ ext_bwidth = min (i, MAX_POSITIVE_INT16);
+
if (rs[Rs_lineSpace] && (i = atoi (rs[Rs_lineSpace])) >= 0)
- lineSpace = min (i, 100); /* arbitrary limit */
+ lineSpace = min (i, MAX_POSITIVE_INT16);
#endif
#ifdef POINTER_BLANK
* i = (int) (ceil (log10 ((unsigned int)parent[0]))) */
for (i = 0, u = (unsigned int)parent[0]; u; u /= 10, i++)
;
- MAX_IT (i, 1);
+ max_it (i, 1);
env_windowid = (char *)rxvt_malloc ((i + 10) * sizeof (char));
sprintf (env_windowid, "WINDOWID=%u",
if (flags & WidthValue)
{
- ncol = BOUND_POSITIVE_INT16 (w);
+ ncol = clamp (w, 0, MAX_POSITIVE_INT16);
szHint.flags |= USSize;
}
if (flags & HeightValue)
{
- nrow = BOUND_POSITIVE_INT16 (h);
+ nrow = clamp (h, 0, MAX_POSITIVE_INT16);
szHint.flags |= USSize;
}
}
else
{
- MIN_IT (width, max_width);
+ min_it (width, max_width);
szHint.width = szHint.base_width + width;
}
}
else
{
- MIN_IT (height, max_height);
+ min_it (height, max_height);
szHint.height = szHint.base_height + height;
}
{
short l = item->len + item->len2;
- MAX_IT (BuildMenu->width, l);
+ max_it (BuildMenu->width, l);
}
}
}
unsigned int button; /* detail */
};
-#define MAX_IT(current, other) if ((other) > (current)) (current) = (other)
-#define MIN_IT(current, other) if ((other) < (current)) (current) = (other)
-#define SWAP_IT(one, two, typeof) \
- do { \
- typeof swapittmp; \
- (swapittmp) = (one); (one) = (two); (two) = (swapittmp); \
- } while (/* CONSTCOND */ 0)
-#define BOUND_POSITIVE_INT16(val) \
- (int16_t) ((val) <= 0 \
- ? 0 \
- : min ((val), (((uint16_t)-1)>>1)))
+#define MAX_POSITIVE_INT16 (((uint16_t)-1)>>1) // TODO: configure/limits
#if ENABLE_FRILLS
typedef struct _mwmhints {
l.t = (text_t *)talloc->alloc (l.t, prev_ncol * sizeof (text_t));
l.r = (rend_t *)ralloc->alloc (l.r, prev_ncol * sizeof (rend_t));
- MIN_IT (l.l, (int16_t)ncol);
+ l.l = min (l.l, ncol);
if (ncol > prev_ncol)
scr_blank_line (l, prev_ncol, ncol - prev_ncol, DEFAULT_RSTYLE);
template<typename T, typename U, typename V> static inline T clamp (T v, U a, V b) { return v < (T)a ? a : v >(T)b ? b : v; }
template<typename T, typename U, typename V> static inline void clamp_it (T &v, U a, V b) { v = v < (T)a ? a : v >(T)b ? b : v; }
-template<typename T, typename U>
-static inline void swap (T& a, U& b) { T t=a; a=(T)b; b=(U)t; }
+template<typename T, typename U> static inline void swap (T& a, U& b) { T t=a; a=(T)b; b=(U)t; }
// in range including end
#define IN_RANGE_INC(val,beg,end) \
if (line->is_longer ()) /* break line continuation */
line->l = ncol;
- max_it (line->l - count, 0);
+ line->l = max (line->l - count, 0);
if (selection.op && current_screen == selection.screen
&& ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))