[2831] in BarnOwl Developers
Re: [PATCH] Punt owl_util_max and owl_util_min in favor of MAX and MIN
daemon@ATHENA.MIT.EDU (Nelson Elhage)
Sun Dec 19 18:00:05 2010
In-Reply-To: <1292439742-27587-1-git-send-email-davidben@mit.edu>
Date: Sun, 19 Dec 2010 18:00:00 -0500
From: Nelson Elhage <nelhage@nelhage.com>
To: David Benjamin <davidben@mit.edu>
Cc: barnowl-dev@mit.edu
lgtm
On Wed, Dec 15, 2010 at 2:02 PM, David Benjamin <davidben@mit.edu> wrote:
> glib already provides those macros which we happily use outside of one
> place.
> ---
> =C2=A0popwin.c | =C2=A0 =C2=A04 ++--
> =C2=A0util.c =C2=A0 | =C2=A0 12 ------------
> =C2=A02 files changed, 2 insertions(+), 14 deletions(-)
>
> diff --git a/popwin.c b/popwin.c
> index 6f8a256..218aae6 100644
> --- a/popwin.c
> +++ b/popwin.c
> @@ -38,9 +38,9 @@ void owl_popwin_size_border(owl_window *parent, void *u=
ser_data)
>
> =C2=A0 owl_window_get_position(parent, &glines, &gcols, 0, 0);
>
> - =C2=A0lines =3D owl_util_min(glines,24)*3/4 + owl_util_max(glines-24,0)=
/2;
> + =C2=A0lines =3D MIN(glines, 24) * 3/4 + MAX(glines - 24, 0) / 2;
> =C2=A0 startline =3D (glines-lines)/2;
> - =C2=A0cols =3D owl_util_min(gcols,90)*15/16 + owl_util_max(gcols-90,0)/=
2;
> + =C2=A0cols =3D MIN(gcols, 90) * 15 / 16 + MAX(gcols - 90, 0) / 2;
> =C2=A0 startcol =3D (gcols-cols)/2;
>
> =C2=A0 owl_window_set_position(border, lines, cols, startline, startcol);
> diff --git a/util.c b/util.c
> index 4e0f352..d478ed1 100644
> --- a/util.c
> +++ b/util.c
> @@ -454,18 +454,6 @@ int owl_util_file_deleteline(const char *filename, c=
onst char *line, int backup)
> =C2=A0 return numremoved;
> =C2=A0}
>
> -int owl_util_max(int a, int b)
> -{
> - =C2=A0if (a>b) return(a);
> - =C2=A0return(b);
> -}
> -
> -int owl_util_min(int a, int b)
> -{
> - =C2=A0if (a<b) return(a);
> - =C2=A0return(b);
> -}
> -
> =C2=A0/* Return the base class or instance from a zephyr class, by removi=
ng
> =C2=A0 =C2=A0leading `un' or trailing `.d'.
> =C2=A0 =C2=A0The caller is responsible for freeing the allocated string.
> --
> 1.7.3.3.399.g06ddf
>
>